LibreOffice from terminal: convert to PDF
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.