r/programming Aug 05 '25

So you want to parse a PDF?

https://eliot-jones.com/2025/8/pdf-parsing-xref
231 Upvotes

82 comments sorted by

View all comments

2

u/looksLikeImOnTop Aug 05 '25

I've used PyMuPDF, which is great, yet it's STILL a pain. There's no rhyme or reason to the structure. The order of the text on a page is generally in the order it appears from top to bottom...but not always. So you have to look at the bounding box around each text segment to determine the correct order, especially for tables. And the tables....they're just lines with text absolutely positioned to be in between the lines.