for web PDFs I'm using https://jina.ai/reader/ — completely free. Does most of the job fine. Code: https://github.com/jina-ai/reader
Ask HN: What are you using to parse PDFs for RAG?
21–30 of 102 posts
Re: Ask HN: What are you using to parse PDFs for RAG?
#22For text, unstructured seems to work quite well and does a good job of quickly processing easy documents while falling back to OCR when required. It is also quite flexible with regards to chunking and categorization, which is important when you start thinking about your embedding step. OTOH it can definitely be computationally expensive to process long documents which require OCR.
For images, we've used PyMuPDF. The main weakness we've found is that it doesn't seem to have a good story for dealing with vector images - it seems to output its own proprietary vector type. If anyone knows how to get it to output SVG that'd obviously be amazing.
For tables, we've used Camelot. Tables are pretty hard though; most libraries are totally fine for simple tables, but there are a ton of wild tables in PDFs out there which are barely human-readable to begin with.
For tables and images specifically, I'd think about what exactly you want to do with the output. Are you trying to summarize these things (using something like GPT-4 Vision?) Are you trying to present them alongside your usual RAG output? This may inform your methodology.
Re: Ask HN: What are you using to parse PDFs for RAG?
#23Re: Ask HN: What are you using to parse PDFs for RAG?
#24Re: Ask HN: What are you using to parse PDFs for RAG?
#25Re: Ask HN: What are you using to parse PDFs for RAG?
#26Re: Ask HN: What are you using to parse PDFs for RAG?
#27This lib converts pdf page by page to image and feed it to gpt-4o-mini The results are pretty good!
Re: Ask HN: What are you using to parse PDFs for RAG?
#28Two approaches I had most, but not full, success with are: 1) converting to image with pdf2image, then reading with pytesseract 2) throwing whole pdfs into pypdf 3) experimental multimodal models
You can get more if you make content more predictable (if you know this part is going to be pure text just put it in pypdf, if you know this is going to be a math formula explain the field to the model and have it read it back for high accessibility needs audience) the better it will go, but it continues to be a nightmare and a bottleneck.
Re: Ask HN: What are you using to parse PDFs for RAG?
#29Re: Ask HN: What are you using to parse PDFs for RAG?
#30https://uglytoad.github.io/PdfPig/
Plus you get to rise the eyebrows of your colleagues.