I have been trying to use a variety of programs to render a multilingual pdf (Hebrew/English dictionary) machine readable. QPDF (as well as pretty much every other program) renders the text as gibberish. I have set --decode-level=all to no avail.

What could be the issue here?


I can't say a lot without seeing that PDF, but some basics:

A PDF contains objects, and some objects contain streams of a simplified variant of Postscript which places glyphs on a page. (You can see the objects by opening the PDF in a text editor, and if you decompress the streams e.g. with mutool, you can also see the streams in a text editor).

It's really difficult to convert that back into the original text (I assume that's what you mean by "machine readable"), because any such attempt has to make assumptions how the rendering application works. If the rendering application just places glyphs in the order in which they are in the original text, you can try to remap glyphs to characters, and just output the characters in this order.

If the rendering program did something more complex, for example because you have two languages with different reading directions, such attempts will fail.

So if you really really need it, you'll have to closely look at how your PDF does things, and write a custom program to convert it back to text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.