# How do I use libreoffice to convert a text file to "pdf" with the output pdf in landscape using (libreoffice –-headless –-invisible –convert-to pdf "filename.txt" )? The text file is 132 columns wide causing the heading and rows to wrap. Can the page size be set to prevent it from wrapping?

I have several text files that need to be converted to "pdf" format and when they are converted using the following command libreoffice –-headless –-invisible –convert-to pdf "filename.txt" the output is in portrait mode instead of landscape.

Is there a way to pass a parameter to force libreoffice to orient the pdf output in landscape?

--Gilbert

edit retag close merge delete

Please use a short descriptive title instead of details into a title.

( 2020-01-15 22:35:47 +0100 )edit

Sort by » oldest newest most voted

When LibreOffice converts files to different formats, it doesn't edit the original documents according to come command line parameters: everything is taken from the documents. If your PDFs arrive portrait, it only means that your original documents were formatted portrait.

more

Thank you for response.. The text file exceeds the standard page size width (8.5 x 11) or 80 columns causing the heading as well as the rows to wrap. Editing the text file with "vi" shows the column width to be 132 columns. Since the original text file arrive with 132 columns, can the page size/or columns be set to prevent it from wrapping the rows?

( 2020-01-15 11:17:30 +0100 )edit

Hi In LO either open the document or create a new document and enter some small lorem ipsum.

On the toolbar: format / page / page / in the dialog box choose the page tab / in the dialog box choose landscape / apply.

Making sure that you are in the new format of the document / go back to file / export as / choose .pdf if you have other export options such as .epub etc.

in dialog box enter a name and verify that the extension is .pdf.

If you have preview thumbnails enabled you should see both the document ( possibly .odt) and the .pdf in landscape format.

jamess

more

OP asked about a command line parameter to achieve landscape while executing libreoffice –-headless –-invisible –convert-to pdf "filename.txt" - your solution requires GUI.