Home / Companies / OpenRouter / Blog / Post Details
Content Deep Dive

How to Extract Tables from a PDF with an LLM

Blog post from OpenRouter

Post Details
Company
Date Published
Author
OpenRouter
Word Count
3,746
Company Posts That Month
19
Language
English
Hacker News Points
-
Post removed?
No
Summary

OpenRouter’s guide explains how to extract PDF tables into typed JSON rows by sending a PDF directly to a file-capable LLM alongside a strict JSON schema, then exporting the validated results to CSV. Schema field descriptions can normalize common table issues such as currency formatting, negative values shown in parentheses, footnote markers, merged cells, and multi-page tables. Tests across five generated PDFs, including scans and difficult layouts, found that models able to read PDFs directly achieved full accuracy on 644 cells, while route selection created important failure risks: OCR via mistral-ocr is needed for scans when the selected model cannot read files, whereas the cloudflare-ai text parser may silently return empty results for scanned PDFs. The guide recommends rejecting empty row sets and any response with a finish reason indicating token-length truncation, since long tables can otherwise produce incomplete but syntactically valid output, particularly with response-healing tools. GPT-6 Luna and Claude Haiku 5.5 were the lowest-cost fully accurate options in the stated test set, although users are advised to evaluate their own documents, layouts, costs, and extraction accuracy. Traditional libraries such as pdfplumber remain suitable for simple digital PDFs but require additional cleanup for merged headers, page breaks, numeric formats, and cannot extract tables from scans.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
LLM 6 6,399 1,189 224 +6%
Gemini 3.8 Flash 4 185 38 23 -45%
Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.