How to batch convert .doc or .docx to .pdf

I need to batch convert a set of .doc or .docx files to .pdf in terminal, not using a GUI.

It would be helpful if I could batch-process multiple files.

I would also like to maintain as much meta-data as possible.

8

4 Answers

lowriter can be used as a command line tool (lowriter is a part of LibreOffice)

lowriter --convert-to pdf *.doc
convert /home/bodhi/Documents/testdoc2.doc -> /home/bodhi/Documents/testdoc2.pdf using writer_pdf_Export
convert /home/bodhi/Documents/testdoc.doc -> /home/bodhi/Documents/testdoc.pdf using writer_pdf_Export
evince testdoc.pdf

I do not have windows, so testdoc download from here

9

I use unoconv, which converts all formats supported by LibreOffice.

1

I use the following script:

for f in *.doc
do
lowriter --headless --convert-to pdf "$f"
done

--headless will prevent Libreoffice from opening 100s of files and eventually crashing if you try this with directories containing a lot of .doc files

1

In my opinion, the best way is with unoconv.

First install the package:

sudo apt install unoconv

and then convert to pdf using this command:

unoconv -f pdf XXYY.docx

(Replace XXYY.docx with the name of your file.)

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like