Conver to xlsx to a horizontal pdf using command line

Hi, im trying to expoet a xlsx file to a PDF usong just command line but the pdf produced has a vertical aligment event though i have set it up to be horizontal using openpyxl. Any help would be appreciate it

It would be helpful, if you could provide anything to look at, especially as your post don’t mention LibreOffice at all: You wish to convert from MS-Office to Adobe files and have generated something with openpyxl.
.
Please attach a generated xlsx example and maybe quote your command in openpyxl.
.
Does your xlsx file open as expected in Excel? Same appearance in LibreOffice? Appearance changed on export to PDF?
.
Also: What is “a vertical aligment event” in a PDF? Or does this term only applies to openpyxl? (Maybe I’m mislead by “event”…)
.
Other thoughts: There are Libraries to write .ods directly, instead of using .xlsx and it is also possible to generate .pds directly from python, if you don’t really need the xlsx/ods-files. An Office-suite as print to pdf may be a bit overkill…
.
One example for code conversion:

Hi Wanderer, I am using this command in python to convert my generated excel file to pdf

import subprocess

command = [‘soffice’, ‘–headless’, ‘–convert-to’, ‘pdf:calc_pdf_Export’, ‘–outdir’, ‘tmp/’, f’{xlsx_path}’]
subprocess.run(command, shell=False)

and before running it I set this configuration in excel sheet using openpyxl

from openpyxl import Workbook

wb = Workbook()
ws = wb.active
ws.page_setup.orientation = ws.ORIENTATION_LANDSCAPE

but the resulting pdf has a vertical orientation.

Have you tried, if Excel accepts this setting?
.
Even without Excel: Try this link

using the code in the link that you shared with me actually helps to produce a pdf in landscape orientation after exporting it to pdf using LibreOffice, however, my table is still compacted to the left in the pdf, by any chance do you know how to fix this ?

I don’t use openpyxl, I only used google a bit, but try this