LibreOffice from terminal: convert to PDF

Published by TheJoe on

Estimated reading time: < 1 minute


This article was published more than a year ago, there may have been developments.
Please take this into account.

With today's article we complete the article in the 31 May concerning the Printing from Client to Server, no drivers whatsoever. Perhaps not everyone knows that LibreOffice and OpenOffice integrate between their packages some commands from flipping through the terminal. These commands are identical for all operating systems (you, for Windows) and produce the same results. Among these we see today is the syntax for convert any file type through terminal opened with LibreOffice / OpenOffice in PDF.

The command for Linux is as follows:

soffice --headless --invisible --convert-to pdf /dir/file.pptx --outdir /dir

It is clear that adding a line to our crontab file can automate the process:

# print server
* * * * * soffice --headless --invisible --convert-to pdf /var/www/uploader/upload/* --outdir ./
* * * * * sleep 15; lpr / var / www / uploads / upload / * | sleep 30; mv / var / www / uploader / uploads / * / var / www / uploader / deposits /
0 4 * * * rm-Rf / var / www / uploader / deposit / *

In this way…

First line: crontab every minute converted in PDF all files in the directory (those referred LibreOffice recognize the extension),

Second line: crontab expected 15 seconds to facilitate the conversion process, the files are then printed and after another 30 seconds moved in the directory “deposit”,

Third row: four in the morning files “deposited” are deleted definitely.

Look here:  NoMachine NX, remote login


I keep this blog as a hobby by 2009. I am passionate about graphic, technology, software Open Source. Among my articles will be easy to find music, and some personal thoughts, but I prefer the direct line of the blog mainly to technology. For more information contact me.


Giovanni Mauri · 14 December 2013 at 4:32 PM

Ciao Marco,
the article is clearly written: “The command for Linux is as follows […]”. I honestly do not know how you could do with windows (I do not have a copy handy). Try looking on the net.

However, if you only need to convert a document that you can just click to open “file” – “Export in pdf format”.

Good luck.

Framework · 28 November 2013 at 7:15 PM

My level is soooo amateur.
I installed LibreOffice, and is located in the folder C:/Programs / LibreOffice 4.
Can you tell me step by step how to launch that command you specified above, to convert a file that is on my desktop(prova.docx) a pdf file (prova.pdf) that you will always find on your desktop?
Thanks a lot in advance.

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.