RAG Over PDFs: Check Your Extracted Text Before You Index
One page of my PDF came back with no text of its own, and nothing warned me.
Video #44 ยท RAG and vector search
Steps in the video
Files
- compare.py (17 lines)
- extract.py (26 lines)
- make_pdf.py (43 lines)
Tested with
Python 3.12.15 | pypdf==6.21.4, fpdf2==2.8.9, pdfplumber==0.11.10, pillow==13.0.0
What this does not show
The PDF is generated by code, which is the easy case. Real PDFs have two columns, rotated text, odd fonts and merged table cells, and will be messier. No OCR was run, so the scanned page is only detected, not read. One small table is a very small test.
Sources
Learning IT by Example.