How to redact PDF files in Okular - Tutorial

Updated: January 11, 2021

The world of PDF files is a vast and complicated one. Viewing files is one thing. Editing them, quite another. Sometimes, you may want to send someone a PDF, but also blank/remove some of the information in the document. This calls for some non-trivial work.

In this article, I'd like to show you how to redact information in PDF documents using the default PDF software available in the KDE/Plasma desktop - Okular. We've talked about this nice little program at length in the past, but now we need to focus on a very specific use case. And please note, this article is not going to be 100% complete. We'll have another tutorial, which also shows how to flatten PDF files.

Teaser

Okular & Annotations

Over the years, the program's interface has changed a little, but the essential functionality remains. Open a document, and then hit F6. Depending on the version of the software, the editing tools toolbar will open on the side or next to the main menu.

Annotations

Highlighter

What we want is the highlighter - this sounds counterintuitive, but 'tis the tool we need. However, by default, Okular will use yellow, transparent color, which does the highlighting, but does no redacting, so to speak. What we need is a black, 100% opaque marker.

Default, yellow color

Edit highlighter options

There are two ways you can do this. You can click on the Expand (>) arrow in the Annotations toolbar, and then click on the Annotations settings button to access the features and make changes to different tools. Or you can right-click on any which highlighted text and edit the properties. The former method allows you to create a global change, whereas the latter lets you customize the color and opacity/transparency for each highlighted line.

Global settings

Global settings changed

Highlighted text properties

Redaction in action

And now, you can go about editing your document as you see fit:

Redaction, working

Conclusion

There you go, the "hack" that lets you redact files in Okular. Very simple and easy to do. But then, there's more to it. What Okular does is effectively add another layer to the PDF and simply obscure the content below with some nice graphics. It doesn't vanish the information. Technically, you can still "see" what's under the highlight marks.

To that end, we need to flatten the PDF files, but since this is a less-than-trivial operation, I am going to write about it in a separate tutorial. For casual uses, the basic redaction above works fine. If you need something more rigorous, then you need a few extra tricks, which we will discuss soon. Stay tuned.

Cheers.

You may also like: