Re:Borb – A Python library to read, write, and edit PDF files
by dunham on Saturday September 18, 2021 @11:29AM
(#28576989)
Some PDF files intentionally include a bad character mapping table (and reorder the font) as a form of DRM.
[ Parent
| on HN ]
Re:Borb – A Python library to read, write, and edit PDF files
by mkl on Saturday September 18, 2021 @11:43AM
(#28577082)
It's not very effective against anyone determined though. You can OCR easily. You can also rebuild the character mapping from the shapes of the glyphs, and in most languages there are few enough that you can even do it by hand.
Re:Borb – A Python library to read, write, and edit PDF files
by mcswell on Saturday September 18, 2021 @12:17PM
(#28577299)
You can OCR if you're using a Latin script with few if any accent marks. Depending on your OCR engine, I suppose you could do Cyrillic too. Other scripts, not so much. (And yes, I'm a computational linguist, so we deal with non-Roman scripts all the time, particularly Arabic script. But I suppose that's not a problem for most people here :-).)
There might be some Latin script fonts that cause problems, but I haven't looked into that very much--I do recall we had problems with an italic font.
Re:Borb – A Python library to read, write, and edit PDF files
by dunham on Saturday September 18, 2021 @03:52PM
(#28578759)
When I came across this I already had a pristine copy of the font, so I just compared the program for each character to determine the mapping. (I was automating the decoding.) I agree that there is little to no security there.
But the point that I was not so clearly trying to make was that sometimes the messed up encoding is intentional and not a bug.