How to edit PDF forms in Linux - with LibreOffice

Updated: July 1, 2019

Necessity is the mother of all inventions. So they say. Indeed, a few days ago, I encountered a curious use case, and I went a-huntin' for a solution to the issue I was having. Namely, I wanted to fill a PDF form with necessary information, without having to actually print the document and write by hand. But the file didn't have interactive fields, and there was nothing in Okular (Plasma's PDF reader) other than annotations that would let me insert text into the document.

I started fiddling and testing, and realized that there wasn't a trivial solution to my need. Then, I decided to give LibreOffice more scrutiny. After all, it can create as well as open PDF files, so maybe this is the right approach? Well, it is! Let me show you how you can use LibreOffice Draw to make the necessary changes in PDF documents and forms, even if they don't have interactive fields. After me.

LibreOffice to the rescue

Let's say you have a PDF file someone gave you and asked you to fill in some details. There's a table, but the document isn't clickable, and your favorite Linux PDF tool does not have the option to insert a cursor at any random position and then type in text you like. But what happens when you open the PDF file in LibreOffice?

Okular, no way to edit the file

No way to nicely edit the file in Okular (and quite a few other PDF readers).

The file will actually open in LibreOffice Draw. For all practical purposes, it's a cross between GIMP, Impress and Microsoft Visio, and it lets you create diagrams, flowcharts and similar. Once you open the document, you can now edit it any which way. But we need to insert a text box. Step one in our journey.

Open PDF file in Draw

Insert text box

Essentially, you're adding a text layer to your file. You can position the text box wherever you like it, resize it, change the font size, and more. You can do this as many times as you like, and you also have the ability to duplicate text boxes, so this saves time. Make the changes you need.

Working

File ready

But LibreOffice Draw will also let you insert the mouse cursor into existing text - provided the PDF file is not protected in some weird (DRM) way - and allow you to change text, if you like. So it's more than just a graphics editor where you treat the PDF documents as a bottom layer of an image. You actually CAN interact with the PDF contents, and this is what makes it extremely valuable.

Export to PDF

Once you're done, export the document as a PDF file. You will now have the original plus all the new text layers you've added, all nicely merged down into a single document. Job done, no need for manual printing, writing, scanning, anything of that sort.

Export to PDF

Okular, same file, with changes

Conclusion

I am quite pleased with this functionality. It's an unexpected little bonus, and it sure does somewhat redeem the mild disappointment I had with LibreOffice recently. The suite has some rather interesting extras that you don't often encounter elsewhere, it's just too bad it doesn't do the basic stuff most people need well. After all, most people won't bother with PDF files, but they will care about their Microsoft documents and image alignment.

However, for those among us who do need to fill in an occasional form, and they don't feel like doing it 1994 style, then LibreOffice Draw offers a really elegant way around the problem. You don't need big and expensive PDF writers or distillers, and you don't need to install any software - other than LibreOffice. You can treat PDF files as editable canvas - both existing text and new layers of annotations and graphics, which you can then export and use as you see fit. Quite handy. I hope this little tutorial was useful. See you around.

Cheers.

You may also like: