Exporting PDFs with LibreOffice on Lubuntu 20.04 (Focal)

Lubuntu 20.04 contains LibreOffice, which has a bug that causes fonts to not be embedded into exported PDFs in at least some instances. When this happens, you may notice some (or all) of the text in an exported PDF appears to be missing. The only supported release of Lubuntu that this bug affects is Lubuntu 20.04 (including point releases such as 20.04.5) - Lubuntu 22.04 is not affected by this bug.

There are a few workarounds to this problem, each with varying pros and cons. This document will walk through each workaround, how to apply it, and what the pros and cons are.

Using the Cairo Renderer

The usual workaround for this problem is to tell LibreOffice to use the Cairo renderer. You don’t have to know what this means, all you have to do to use it is to execute the following command in a terminal:

SAL_VCL_QT5_USE_CAIRO=true libreoffice --writer

This should allow you to export PDFs properly.

The main issue with this solution is that LibreOffice’s window will occasionally become corrupted (this is most noticable immediately after opening a document). When this occurs, simply unmaximize the LibreOffice window, then maximize it again (or vice-versa if you were intentionally using LibreOffice unmaximized). This will cause the screen corruption to vanish until the next time something triggers it to occur (like opening another document).

Another downside of this workaround is that it requires that LibreOffice be launched from a terminal - any time you need to open LibreOffice Writer, you’ll have to do it using this command in a terminal (unless you are able to write a shell script or desktop file to launch LibreOffice with this command).


This workaround is almost identical to the previous workaround, but the command is slightly different:

SAL_USE_VCLPLUGIN=kf5 libreoffice --writer

Run the above command in a terminal to launch LibreOffice Writer. This should allow you to export PDFs properly.

While screen corruption does not appear to occur when using this workaround, you may notice that some of LibreOffice looks slightly different than normal (the menus look a bit different, the box that asks if you really want to overwrite a file looks very different). This is expected behavior. This workaround will also require that you launch LibreOffice from a terminal or by using somewhat advanced techniques.

Removing libreoffice-qt5

This method is somewhat drastic, but has the added advantage of being a permanent solution - you only have to run one command once, and LibreOffice should export PDFs normally, even if you launch it from the application menu.

Run the following command in a terminal:

sudo apt remove libreoffice-qt5

You will be prompted for your password - type it and then press Enter. Then press Y to confirm that you really do want to remove the package, and press Enter one last time. When the command finishes, close the terminal window, and restart any running instances of LibreOffice. You will notice that LibreOffice will look a little different, and PDFs should now export correctly.

Special thanks to all the users on Discourse who shared and confirmed the usefulness of some of these workarounds! The original post that this guide is built on can be found here: LibreOffice export to PDF has no text