Lurker News
Hi, I've just finished a rebuild of this function and added a lot of new features: info, page index, minimap, inverted index,... I think it may be useful for inspection, debugging or just as a learning resource showcasing the PDF file format. This is a pet project and I would be happy to receive some feedback! Regards

Comments (57) 18 threads

codetrotter7 replies#
Many moons ago I was tasked with extracting data from a bunch of PDFs. I made a tool to visualise how characters were laid out on the page and bounding boxes of all the elements.

The project was in the end a complete failure and several people were upset at me for not delivering what I was supposed to.
In present day, with the capabilities that are now available with LLMs to extract data from PDFs I 100% would go the route of utilising AI to extract the data they wanted. Back then that did not yet exist.

GaggiX#
It reminds me of: https://xkcd.com/1425/

In the same way now with today's AI models the task is easily achievable.

jimjimjim#
The LLMs might help with sequencing the characters you extract from the page but actually getting the contents is still difficult. A number of times I've come across a page where the letters of the text are glyphs in a custom font with no mapping to ascii or anything similar or even more common, especially with output from CAD, are letters that are made by drawing lines in the shape of letters so there is nothing identifiable to extract and you are left with OCRing the page to double check the results
macklinkachorn#
In my previous role, I have experienced similar things where the rule-based parsing approach is really tricky to get right and often failed via from edge cases.

We (at https://runtrellis.com/) have been building PDF processing pipeline from the ground up with LLMs and VLMs and have seen close to 100% accuracy even for tricky PDFs. The key is to use rule based engine and references to cross check the data.

bob10291 reply#
Parsing data out of arbitrary PDFs is a cursed mission. PDF can contain images, so you might as well target JPEG directly.

OCR can take you pretty far depending on expectations, but it's never quite far enough in my experience.

themanmaran#
That's been our experience as well. Just scrapping any of the metadata associated with the PDF and treating it like an image. Since you never know when a document has a screenshot of an excel table inside.

The .NORM files (https://xkcd.com/2116)

aboardRat4#
mathpix does quite an awesome job actually
rad_gruchalski#
pdfjs does all of that and it’s pretty solid. I used it recently to extract tabular data out of 10 year batch of bank statements.
spacecadet1 reply#
Many moons ago worked on extracting 2D CAD drawings from PDFs and converting to full 3D. Fun times.
gsempe1 reply#
I’m very interested on if you managed to make it works?
spacecadet#
Yes and no. Had some initial prototype but had issues with all of the edge cases related to document formatting and detail and eventually abandoned it.
Muromec#
That's pretty cool! I would have used it a lot at my previous job if it existed back then. In my ideal world it should work somewhat like https://lapo.it/asn1js/ -- you drop a file and it does all the stuff locally.
swsieber#
I've used the iText RUPS (free) for a while for debugging PDFs (as I have the "privilege" to work on code that extracts data from PDFs...). It looks like your introspection stuff might be a bit stronger, which would be great. I'll take it for a whirl.
est3 replies#
I remember there was a similar project on github allows visualize any type of binary data by a given schema. There was an TCP/IP example IIRC.
ddulaney1 reply#
https://kaitai.io/ maybe?

It looks perfectly nice for its role, but I didn’t use it for my last project because I need serialization as well.

elliottcarlson#
Kaitai is very useful for reverse engineering a binary file that you have some assumptions of. I've used it for save file reverse engineering and then creating a read/write library for it. It should be usable for PDF Metadata.
mdaniel#
Be careful, "any" is a strong word in this context. Interestingly enough, I actually use PDF as the "hello world" for kicking the tires on any such file format descriptor I find because PDF is such a crazypants specification. Thus, if the descriptor language is able to accurately capture the layout of a PDF, it's obviously well thought out.

I haven't had a lot of luck thus far, except ones which allow escaping out of declarative mode over into "and then run this code"

Load more comments