
On Sun, Mar 23, 2025 at 04:00:15PM -0400, D. Hugh Redelmeier via talk wrote:
Sometimes you want to remove confidential parts of a PDF file. Governments do this all the time. I wanted to do this too.
It turns out to be hard. Governments get this wrong too. It is easy to scribble over something but skilled readers can remove these scribbles.
What I ended up doing was using GIMP. The best open source tool. I sure didn't want to put my confidential stuff through an internet tool
When loading the document into GIMP, it naturally puts each page in a different layer. That's not a great model but it kind of works. If your document is too big, break it up.
With the layers menu, you will see each layer listed. Back to front.
For each layer: look at the layer menu make sure that it is the only layer is visible: make sure that the only eyeball icon in the first column is for the layer of interest. click on the layer's image icon
Move to the image window. select the rectangle selection tool: Tools: Selection Tools: Rectangle Select (or other suitable tools) for each area to censor, select the area censor it by your choice of Edit: Fill With FG color or Fill With BG color (you will type these a lot so learn the shortcut)
select all the layers (in the Layers menu: all eyeballs on)
File: Export as: select PDF file type/suffix. Pick a new name to not overwrite your original.
The result may be a very large file. I reduced the size (and quality?) $ pdf2ps doc.pdf skinny.ps $ ps2pdf skinny.ps skinny.pdf This probably destroys resolution. You can use GhostScript directly and have more control.
Doesn't doing that turn the pdf into images? As far as I a concerned, a pdf document with text in it that isn't searchable or doesn't allow copying text is ruined. I suspect people with screen readers would be more upset than me. -- Len Sorensen