Using LibreOffice to edit PDFs

If you’ve ever needed to modify a PDF, then you’d know the only tools in town are pretty much paid tools. That is, unless you know how to use LibreOffice.

I hear you, you’re probably saying, “But, Lee, LibreOffice doesn’t work! Anytime I try to modify a PDF the font changes!

And you’d be right. But there’s a way around that. I dug a bit deeper as to why this happens, and I noticed something.

If fonts don’t appear the same way as they would in a PDF viewer, then chances are you just don’t have the correct fonts installed. Simple right? If you’re wondering what specific font you need, LibreOffice will actually tell you what it’s looking for, albeit in a subtle and not at all intuitive way. Let’s open up a document that is mostly text and has its own unique font, say a phone bill.

Here we have what the bill SHOULD look like, versus what LibreOffice renders:

This is a classic example of not having the right fonts installed.

As you can see, LibreOffice is completely able to grab the text from a PDF, but for every font it can’t find it uses Libre Serif as a default font. The paid-for PDF editors do the exact same thing that LibreOffice does, except for every font that it encounters that it can’t resolve, it simply renders that section of a PDF normally until you make changes to the text. THEN it will throw up its hands and tell the user to supply fonts.

But, hey, if you’re having to change fonts already, why not just go down the free route with LibreOffice?

I think it might be a bug, but LibreOffice will actually tell you what font it expects to see. By clicking on a text block you can sometimes see in the property window what font it expects:

In this case we have TeleGroteskUltular. Using a search engine, we can quickly find this site where we can download Tele GroteskUlt a seemingly similar font. Using Ubuntu as an OS, installing fonts is easy. You just double click and hit install. Bada bing.

If you install a font, make sure you restart LibreOffice if you had it open while installing. LibreOffice populates its font at program startup.

In LibreOffice you into Tools->Options->Fonts and fill out your replacement table like something similar to this:

The fonts you want to replace won’t appear in the Font drop down list on the left. You’ll have to manually input the font names, or copy them from the properties screen as seen in an earlier screenshot. The replacement fonts should appear if they were installed correctly and if LibreOffice wasn’t opened when you installed them.

Here’s a comparison of the bill now:

It’s not perfect by any means, but it’s closer than it was before, and none of the text is spilling over. I replaced three unique fonts with one font, so I didn’t think it was going to be perfect. You can keep downloading and installing fonts until one of them works, or if you’re really obsessive you can make your own fonts.

I don’t think this solution will work for everyone, but it is free, so there’s that.