A simple way to convert lots of .docx/.DOCX files to .pdf files on Debian 11 using LibreOffice, and fixing the initial error

I was sent a whole load of .docx files.

Not a problem, because LibreOffice opens them.

But I want them as .pdf files, so I can scribble on them as I read them, using Xournal++.

How to convert a whole folder full of .docx files to .pdf easily?


libreoffice --headless --convert-to pdf *.docx

Since this is case-sensitive, if you've got files with a shouty .DOCX extension, you'll need to vary this, or just run it again with the different extension.

But I got an error message:

javaldx: Could not find a Java Runtime Environment!
Please ensure that a JVM and the package libreoffice-java-common
is installed.
If it is already installed then try removing ~/.config/libreoffice/4/user/config/javasettings_Linux_*.xml
Warning: failed to read path from javaldx

First things first, I installed libreoffice-java-common.

No change.

So I tried deleting ~/.config/libreoffice/4/user/config/javasettings_Linux_*.xml.

No change.

What fixed it for me was installing libreoffice-base, which I had thought was already there, but was not:

sudo apt install libreoffice-base -y

After that, it works: a very quick way of converting a lot of .docx/.DOCX files to .pdf.

Author: neil

I'm Neil. By day, I run a law firm, decoded.legal, giving advice on Internet, telecoms, and tech law. This is my personal blog, so will be mostly about tech stuff, cycling, and other hobbies.

You can find me (and follow me) on Mastodon and Twitter.