Is there a better way to redact a PDF?
I had to print a couple of PDFs recently to send to someone, but I wanted to redact (black out) a couple small bits of text.
A quick google search didn't turn up any tools for this specific purpose, so I fell back to imagemagick & gimp:
convert document.pdf document.png
gimp document-0.png
- (use paintbrush to black out text)
- print redacted page from gimp
- print remaining pages from xpdf
The problem with this strategy is that the conversion process (from PDF to PNG or whatever other format) loses quality. I tried editing the PDF in gimp but it didn't work right away.
Is there a specific tool that permits redaction in this way? (It doesn't even need to be "real" redaction -- I'm not sending a softcopy so "fake" redaction will work because the hardcopy can't be hacked to reveal the underlying text.)
Or, is there a trick to being able to edit PDFs in gimp?
Solution 1:
You can use Okular.
sudo apt-get install okular
- Open the pdf with Okular.
- Press F6.
- Press 8.
- Highlight the text you wish to redact.
- Right click the text, select properties, select the "Type" as "Highlight", press Ok.
- Print the file to a pdf (check "Force rasterization" to make sure the redacted text is removed from the resulting file).
Solution 2:
(originally I recommened Okular but it didn't work as I expected)
1. Edit the document in a vector editor
I was able to open a PDF file in Inkscape, draw a rectangle over a piece of text and print it out. Inkscape is a vector editor so no rasterization involved. Some fonts looked wrong though - probably because the document was created on Windows machine with fonts which are absent on mine.
Note that any method that does not involve rasterization is only acceptable if you're going to print the redacted document on paper and not distribute it electronically, as the text still can be retrieved from under blackouts.
2. Increase the rasterization resolution when opening in a bitmap editor
Regarding "quality loss" when opening the page in Gimp: you can directly open a PDF file in Gimp. It will be rasterized in the process. The amount of quality loss in the process is a matter of resolution you choose when importing - 300 dpi should give you a very decent quality (the default is 100).
You can also get good results with ImageMagick's convert
command if you tell it to increase resolution:
convert -density 300x300 ...