Redacting a PDF using Okular
When sharing PDF files, it is often necessary to hide sensitive information.
For example, in the Netherlands companies are legally prohibited from storing someone's burgerservicenummer (this is something like a social security number).
If you have to send proof-of-income documents to a mortgage broker, for example, you have to redact parts of the PDF or they won't accept them.
This guide shows how to redact information from a PDF using Okular on Ubuntu.
is a universal document viewer.
Okular can highlight and annotate PDF files, which is what we'll use to redact information.
To get started, install Okular:
sudo apt install okular
Next up, open the file you'd like to redact.
In Okular's toolbar, click
Tools > Review, or press
F6 on your keyboard.
A small toolbar with review tools has now opened. Select the "highlight" tool from the toolbar and underline the text you'd like to redact. After you've done that, right click the underlined text and click "properties". Change the type to "Highlight". The black highlight makes the text unreadable:
Now that we've hidden the text, we can save the PDF.
Don't save the file normally!
You might think you can just save the pdf and be done with it, but it isn't that simple. The text you've redacted isn't actually gone, it is just hidden by a black highlight. If you save the PDF normally you can still read the text from underneath the highlight:
To solve this problem, we have to rasterize the PDF.
Force rasterization and save
To save the file and really hide the information, we have to rasterize the pdf.
Rasterizing means that all the content and text inside the PDF gets turned into pixels.
Think of it like taking a picture of the PDF.
To rasterize and save this PDF, click
File > Print... in the toolbar.
Select "Print to File (PDF)" as your printer.
Click the "Options" button and go to "PDF Options", check the "Force rasterization" checkbox.
That's all there is to it. We now have a PDF with our sensitive information hidden.