"PDF to Text" is a bit simplified IMO. There's actually a few class of problems within this category: 1. reliable OCR from documents (to index for search, feed into a vector DB, etc) 2. structured data extraction (pull out targeted values) 3. end-to-end document pipelines (e.g. automate mortgage applications) Marginalia needs to solve problem #1 (OCR), which is luckily getting commoditized by the day thanks to models…
PDF to Text, a challenging problem
71–80 of 206 posts
Re: PDF to Text, a challenging problem
#72The better solution is to embed, in the PDF, the editable source document. This is easily done by LibreOffice. Embedding it takes very little space in general (because it compresses well), and then you have MUCH better information on what the text is and its meaning. It works just fine with existing PDF readers.
But generally speaking, you don't have that control.
Re: PDF to Text, a challenging problem
#73Yeah, getting text - even structured text - out of PDFs is no picnic. Scraping a table out of an HTML document is often straightforward even on sites that use the "everything's a " (anti-)pattern, and especially on sites that use more semantically useful elements, like . Not so PDFs. I'm far from an expert on the format, so maybe there is some semantic support in there, but I've seen plenty of PDFs where tables are s…
Re: PDF to Text, a challenging problem
#74Re: PDF to Text, a challenging problem
#75I think using Gemma3 in vision mode could be a good use-case for converting PDF to text. It’s downloadable and runnable on a local computer, with decent memory requirements depending on which size you pick. Did anyone try it?
Re: PDF to Text, a challenging problem
#76Below is a PDF. It is a .txt file. I can save it with a .pdf extension and open it in a PDF viewer. I can make changes in a text editor. For example, by editing this text file, I can change the text displayed on the screen when the PDF is opened, the font, font size, line spacing, the maximum characters per line, number of lines per page, the paper width and height, as well as portrait versus landscape mode. %PDF-1.4…
"2.3.2 Portability
A PDF file is a 7-bit ASCII file, which means PDF files use only the printable subset of the ASCII character set to describe documents even those with images and special characters. As a result, PDF files are extremely portable across diverse hardware and operating system environments."
https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandard...
Re: PDF to Text, a challenging problem
#77Disclaimer: I'm the founder.
Re: PDF to Text, a challenging problem
#78Earlier quoted context omitted.
I wonder if AI will solve that
There are specialized models, but even generic ones like Gemini 2.0 Flash are really good and cheap, you can use them and embed the OCR inside the PDF to index to the original content.
Fundamentally, the solution to this problem is to not create it in the first place. There's no reason for there to be a structured data -> PDF -> AI -> structured data pipeline when we can just force people providing evidence to provide the structured data.
Re: PDF to Text, a challenging problem
#79One thing I wish someone would write is something like the browser's developer tools ("inspect elements") for PDF — it would be great to be able to "view source" a PDF's content streams (the BT … ET operators that enclose text, each Tj operator for setting down text in the currently chosen font, etc), to see how every “pixel” of the PDF is being specified/generated. I know this goes against the current trend / state-…
When you use PDF.js from Mozilla to render a PDF file in DOM, I think you might actually get something pretty close. For example I suppose each Tj becomes a and each TJ becomes a collection of s. (I'm fairly certain it doesn't use .) And I suppose it must be very faithful to the original document to make it work.
Re: PDF to Text, a challenging problem
#80The better solution is to embed, in the PDF, the editable source document. This is easily done by LibreOffice. Embedding it takes very little space in general (because it compresses well), and then you have MUCH better information on what the text is and its meaning. It works just fine with existing PDF readers.
The better solution to a search engine extracting text from existing PDFs is to provide advice on how to author PDFs? What's the timeline for this solution to pay off