Edit PDFs with Xournal

Forget all of those magical command-line PDF incantations and edit your PDFs easily with Xournal.

Somehow, despite all the issues with proprietary clients and the history of security issues with Acrobat, PDFs have become the de facto standard for your average print-ready document shared around the office. Sure, people might use some kind of open document format or a cloud editor if they intend to edit a document, but if the goal is to print the document or lock its contents in place, most people these days will export it to a PDF.

Reading PDFs is typically fine on Linux, because Linux has plenty of applications that can open PDFs for viewing, and you easily can print PDFs under Linux as well. Even Adobe supplied a proprietary (and somewhat outdated) port of its Acrobat Reader for Linux. Some distributions also offer the ability to create a special software printer that converts any print job sent to it into a local PDF file.

The problem comes when people want to turn read-only print-ready PDFs into read-write documents you need to modify. As more people work in paperless offices with strictly digital documents and fewer people own fax machines, you are more likely to find official documents like contracts show up in your INBOX in PDF format. These contracts likely were created with a proprietary PDF editor tool, and they usually have blanks for you to fill in and often signature lines so you can add a real signature. Unfortunately, for the longest time, even if you were using Adobe's own Linux port of Acrobat Reader, you couldn't reliably edit these PDFs, and you certainly couldn't easily add a real signature.

A lot of Linux applications claim the ability to edit PDFs from graphical tools like GIMP, or the aforementioned Acrobat Reader or tools like Inkscape. In the past, I've even gone so far as to use command-line tools to convert a PDF into multiple pages of a different format, edit that format, then use the command-line tools to convert it back to a PDF.

Then I discovered Xournal. Xournal is a graphical tool that's designed for note-taking and sketching either with a keyboard and mouse or even with a tablet and stylus. This program is pretty common, and you should be able to install it in any major Linux distribution, but otherwise, you can download the software from its Sourceforge page.

The particularly nice thing about Xournal is that it can import PDFs and display them like any other document, but because Xournal is designed for note-taking, you can pick its text or pencil tools and type or draw directly on the PDF! This means when you get a contract with a bunch of blanks to fill in, you can select the text tool from the toolbar, select the area where you want to type, and then fill in all those blanks. Then when you get to the signature page, you can zoom in on the signature section, select the pencil tool and then sign with your mouse! If you have a tablet or a laptop with a touchscreen, it's even easier, as you can use a stylus.

The most important thing to note when editing PDFs with Xournal is that to save your changes, you don't just click Save but instead click File→Export to PDF. If you are editing a PDF, I suggest exporting into a new document—I've noticed in the past that sometimes if I save on top of an existing PDF, it will overwrite only a particular layer, so I'll see a blank document apart from my changes. If you export to a new PDF, you can avoid this risk while also preserving your original, unedited PDF.

So next time you get a PDF you need to edit, put away those crazy command-line tools (and that Windows VM, for shame!) and break out Xournal. It's easy, works well, and I wish I'd known about it years ago!


Xournal SourceForge Page

Kyle Rankin is a Tech Editor and columnist at Linux Journal and the Chief Security Officer at Purism. He is the author of Linux Hardening in Hostile Networks, DevOps Troubleshooting, The Official Ubuntu Server Book, Knoppix Hacks, Knoppix Pocket Reference, Linux Multimedia Hacks and Ubuntu Hacks, and also a contributor to a number of other O'Reilly books. Rankin speaks frequently on security and open-source software including at BsidesLV, O'Reilly Security Conference, OSCON, SCALE, CactusCon, Linux World Expo and Penguicon. You can follow him at @kylerankin.

Load Disqus comments