Site icon libreofficehelp.com

Batch Convert Writer Documents to PDF in LibreOffice

This advanced tutorial would help you to batch convert Writer documents (docx, odf, odt) to PDF using the free LibreOffice office suite.

Converting multiple Microsoft Word *.docx, *.doc OR open document format files – *.odf, *.odt files to PDF at once can be tricky. Especially, if you are dealing with hundreds of files and need to convert them into PDFs in batches. You can convert hundreds, and thousands of files to PDF using the free LibreOffice office suite.

Steps to convert document files to PDF

Note: The steps are different for Windows and Linux. Follow accordingly.

Convert a single file

"C:\Program Files (x86)\LibreOffice 5\program\swriter.exe" --headless --convert-to pdf Untitled1.odt
lowriter --headless --convert-to pdf Untitled1.odt

Note:

Convert multiple files via batch mode

For %f in (*.odt) do (
"C:\Program Files (x86)\LibreOffice 5\program\swriter.exe" --headless --convert-to pdf %f
)
lowriter --headless --convert-to pdf *.odt
Batch convert Writer documents in Linux

Additional Options for batch conversation via command line (LibreOffice 7.4 and above)

LibreOffice 7.4 and above offers the following options for better control while using the command line. Here are some examples.

soffice --convert-to 'pdf:draw_pdf_Export:{"PageRange":{"type":"string","value":"2-"}}' test.odg
soffice --convert-to 'pdf:draw_pdf_Export:{"TiledWatermark":{"type":"string","value":"draft"}}' test.odg
soffice --convert-to 'pdf:draw_pdf_Export:{"EncryptFile":{"type":"boolean","value":"true"},"DocumentOpenPassword":{"type":"string","value":"secret"}}' test.odg
soffice --convert-to 'pdf:draw_pdf_Export:{"SelectPdfVersion":{"type":"long","value":"15"}}' test.odg
soffice --convert-to 'pdf:draw_pdf_Export:{"SignPDF":{"type":"boolean","value":"true"},"SignCertificateSubjectName":{"type":"string","value":"CN=…"}}' test.odg

Conclusion

The above methods explain how you can easily batch convert Writer documents (docx, odt) to pdf using free LibreOffice Writer. You do not need any other software, installers, or pdf printers for this work.

Drop a comment below if this article helped you or if you have any questions.

Reference

--convert-to OutputFileExtension[:OutputFilterName]
[--outdir output_dir] [--convert-images-to]
Batch convert files (implies --headless). If --outdir
isn't specified, then current working directory is used
as output_dir. If --convert-images-to is given, its
parameter is taken as the target MIME format for *all*
images written to the output format. If --convert-to is
used more than once, the last value of OutputFileExtension
[:OutputFilterName] is effective. If --outdir is used more
than once, only its last value is effective. For example:
--convert-to pdf *.odt
--convert-to epub *.doc
--convert-to pdf:writer_pdf_Export --outdir /home/user *.doc
--convert-to "html:XHTML Writer File:UTF8" *.doc
--convert-to "txt:Text (encoded):UTF8" *.doc
Exit mobile version