How to Extract Tables from a PDF with an LLM
How to Extract Tables from a PDF with an LLM
The guide shows how to send a PDF to a file-reading model together with a strict JSON schema describing one row, so the model returns typed rows with cleanup such as parenthesized negatives and footnote markers handled by field descriptions. In tests over five PDFs (two scans, 644 cells), every model that read the PDF directly got all cells right, while failures came from the parser route and output token limits, including two silent failures. It recommends rejecting empty results and any response whose finish_reason is "length", and comparing routes on your own PDFs before choosing one.
Offers a concrete, tested recipe with code for schema-driven PDF table extraction, plus specific guidance on silent failure modes worth knowing before building a pipeline.
Source: OpenRouter Announcements · openrouter.ai