Ask Your Question

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?

asked 2020-01-14 19:35:41 +0100

gilbert morgan gravatar image

updated 2020-01-15 11:29:26 +0100

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?


edit retag flag offensive close merge delete


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

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

2 Answers

Sort by » oldest newest most voted

answered 2020-01-14 19:51:36 +0100

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.

edit flag offensive delete link 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?

gilbert morgan gravatar imagegilbert morgan ( 2020-01-15 11:17:30 +0100 )edit

answered 2020-01-15 00:57:37 +0100

jamess gravatar image

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.


edit flag offensive delete link 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.

Opaque gravatar imageOpaque ( 2020-01-15 01:44:37 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-01-14 19:35:41 +0100

Seen: 49 times

Last updated: 2 days ago