News for hackers. Stuff that matters.
Re:So you want to modify the text of a PDF by hand by enriquto on Monday September 04, 2023 @04:15PM (#37384546)
You can do this:

    pdf2ps a.pdf    # convert to postscript "a.ps"
    vim a.ps        # edit postscript by hand
    ps2pdf a.ps     # convert back to pdf
Some complex pdf (with embedded javascript, animations, etc) fail to work correctly after this back and forth. Yet for "plain" documents this works alright. You can easily remove watermarks, change some words and numbers, etc. Spacing is harder to modify. Of course you need to know some postscript.
Re:So you want to modify the text of a PDF by hand by indeedmug on Monday September 04, 2023 @09:30PM (#37386878)
If you can put javascript and animations in pdf, what's stopping you from making a frontend in it? I wonder what are the frontiers of things you can do in pdf.

Honestly, it seems like only malware authors benefit from the complexity of pdfs.

Re:So you want to modify the text of a PDF by hand by lionkor on Tuesday September 05, 2023 @02:50AM (#37388665)
The most widespread javascript packaging format turns out to be PDF[1]

[1] source: made it up

Re:So you want to modify the text of a PDF by hand by haraldooo on Tuesday September 05, 2023 @03:06AM (#37388752)
MacOS‘s Quartz (original 2D rendering) is based on pdf: https://www.prepressure.com/pdf/basics/osx-quartz
Re:So you want to modify the text of a PDF by hand by Tyr42 on Tuesday September 05, 2023 @01:37PM (#37395156)
[delayed]
Re:So you want to modify the text of a PDF by hand by hnick on Monday September 04, 2023 @11:39PM (#37387590)
This is essentially how we used to do it for some "print-ready" jobs at a mailhouse I worked at. Usually we'd use proper tools to produce documents ready to print, but sometimes clients thought they knew better and would send us PDFs. It was more effort to work with those usually, and had a higher chance of errors.

Even if the output was correct, we still needed to re-order pages, apply barcodes for mail machine processing and postal sorting, and produce reports - which usually involved text scraping off the page to get an address via perl and other tools. Much easier in PS than PDF usually, but sometimes very unreliable when e.g. their PDFs were 'secure' and didn't have correct glyph mappings.

In the worst cases, they would supply single document PDFs, and merging those would cause an explosion of subset fonts in the output which would fill the printer's memory and crash it. When I stopped working in the area, I think there still wasn't a useful tool to consolidate and merge subset fonts known to come from the same parent font - it would have been a very useful tool and should be possible but I didn't have the time or knowledge to look into it.

Re:So you want to modify the text of a PDF by hand by hackernewds on Tuesday September 05, 2023 @12:23AM (#37387835)
in vim?
Re:So you want to modify the text of a PDF by hand by enriquto on Tuesday September 05, 2023 @02:16AM (#37388449)
It doesn't matter, just use any text editor.