Camelot finds 0 tables in a scanned PDF with every flavor but ml, which needs PyTorch and took about 2 minutes on CPU for 1 page. parserkit reads the scan with OCR for $0.02 a page, 50 pages free.
camelot read_pdf finds no tables
camelot.read_pdf(path) returns <TableList n=0> for two reasons: the page has no text layer (stderr shows a warning from camelot/parsers/base.py line 132), or the default lattice parser is hunting for cell borders that aren't there. The fix for each is below, and parserkit skips both.
Error fixesUpdated
$ python find_tables.py invoice-ridgeback-v-scan.pdf
/workspace/venv/lib/python3.13/site-packages/camelot/parsers/base.py:132: UserWarning: page-1 is image-based, camelot only works on text-based pages.
warnings.warn(
<TableList n=0>Causes
Why it happens and the fix for each
The page is a scan
When you run
python find_tables.py invoice-ridgeback-v-scan.pdf, Camelot's built-in parsers can't read the page because it's an image. You'll see"UserWarning: page-1 is image-based, camelot only works on text-based pages."fromcamelot/parsers/base.pyline 132, andlattice,stream,network,hybrid, andautoall return<TableList n=0>. This is the same root issue as when PDF text extraction comes back empty. As the Camelot docs say, "The recommended workflow is to add a text layer first, then run Camelot."flavor="ml"reads scans too, at the install and CPU cost shown below. Or send the scan to the PDF table extraction API, which runs OCR for you in the same call.The default lattice flavor needs ruling lines
On
invoice-ridgeback-v-digital.pdf, which is the same borderless invoice with a text layer, a plaincamelot.read_pdf(path)call still returns<TableList n=0>. There's no warning this time, which is how you know the page has text. The default flavor islattice, which the docs say "can be used to parse tables that have demarcated lines between cells". Even though Camelot 2.0.0 (released on 2026-06-04) changed thelatticedefaultline_scalefrom 40 to 15, it still needs drawn lines. Switch the call tostream, which "can be used to parse tables that have whitespaces between cells". The table below shows what each flavor found on the digital file (tabula has the same problem withlattice=True, see tabula read_pdf not working).Python import camelot tables = camelot.read_pdf("invoice.pdf", flavor="stream", pages="all") print(tables.n, [table.shape for table in tables]) print(tables[0].df)Ghostscript is not installed (Camelot before 1.0)
If you're on an older release like
camelot-py0.11.0 andPATHhas no Ghostscript binary, runninglatticeon the text PDF crashes before it checks for tables. You'll getOSError: Ghostscript is not installed.fromcamelot/backends/ghostscript_backend.py, line 31. Upgrade to Camelot 1.0.0 or newer, where a plain install needs no system dependencies; "as of v1.0.0 ghostscript is replaced by pdfium as the default image conversion backend." When we ran the same call oncamelot-py2.0.0 without Ghostscript installed, it raised nothing.camelot-py 0.11.0, no gs on PATH File "/workspace/venv-cam011/lib/python3.11/site-packages/camelot/backends/ghostscript_backend.py", line 31, in convert raise OSError( OSError: Ghostscript is not installed. You can install it using the instructions here: https://camelot-py.readthedocs.io/en/master/user/install-deps.htmlflavor="ml" reads scans, with heavy extras
The docs note that "flavor='ml' is the only parser that works without a text layer at all." To use it, you install the
[ml]extra (which pulls intorch,transformers, andtimm) and the[ocr]extra (which "installs rapidocr-onnxruntime, the OCR text source that flavor='ml' uses on scanned / image-only PDFs"). Watch your Python version, though. On Python 3.13, runningpip install "camelot-py[ml,ocr]==2.0.0"failed for us withERROR: No matching distribution found for rapidocr-onnxruntime>=1.3; extra == "ocr"because the newest version pip offered was 1.2.3. Dropping to Python 3.12 letflavor="ml"run on the scan: it took 120 seconds on CPU and returned 1 table of 6 rows by 4 columns, where the quantities and amounts were right, the descriptions lost their spaces ("Coffeebag labels,matte,3by4in"), and the subtotal, tax, and totals weren't in the table. parserkit read the same scan in one call with nothing to install, totals included, each one added up again.pip on Python 3.13 $ pip install "camelot-py[ml,ocr]==2.0.0" ERROR: No matching distribution found for rapidocr-onnxruntime>=1.3; extra == "ocr"OCR first, then stream
If you follow the docs and run
ocrmypdfon the scan first, the file gets a text layer, so the image-based warning goes away. When we ran the parsers on that OCR copy,lattice,network, andhybridall found 0 tables, whilestreamfound 3 tables. You can tell the OCR layout confused the parser because the firststreamtable was just the letterhead, with doubled spaces between words. Ifstreamsplits your header into a table or mangles spacing after OCR, send the scan to parserkit instead of chaining tools: one call, OCR included, and every row and total added up again.
Example
The same scanned invoice through parserkit
invoice-ridgeback-v-scan.pdf is the scan every Camelot flavor returned n=0 for. With the invoice preset it came back as fields and line items, each row and total added up again.
POSTapi.parserkit.com/v1/parse?wait=60
curl "https://api.parserkit.com/v1/parse?wait=60" \
-H "Authorization: Bearer $PARSERKIT_API_KEY" \
-F file=@invoice-ridgeback-v-scan.pdf \
-F preset=invoiceimport os
import requests
with open("invoice-ridgeback-v-scan.pdf", "rb") as file:
res = requests.post(
"https://api.parserkit.com/v1/parse",
params={"wait": 60},
headers={"Authorization": f"Bearer {os.environ['PARSERKIT_API_KEY']}"},
files={"file": file},
data={"preset": "invoice"},
)
job = res.json()
for item in job["data"]["line_items"]:
print(item["description"], item["quantity"], item["unit_price"], item["total"])import { openAsBlob } from "node:fs";
const form = new FormData();
form.append("file", await openAsBlob("invoice-ridgeback-v-scan.pdf"), "invoice-ridgeback-v-scan.pdf");
form.append("preset", "invoice");
const res = await fetch("https://api.parserkit.com/v1/parse?wait=60", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PARSERKIT_API_KEY}` },
body: form,
});
const job = await res.json();
console.table(job.data.line_items);1 of 46 values went unchecked: payment.account_number, since no checksum covers a US account number and it was not matched in the page's OCR words.
{
"id": "job_6f2hce27c6f736c1jvqu",
"status": "succeeded",
"pages": 1,
"digital_pages": 0,
"ocr_pages": 1,
"cost_usd": 0.02,
"verification_status": "partial",
"duplicate": null,
"data": {
"invoice_number": "RB-2236",
"issue_date": "2026-11-04",
"due_date": "2026-12-04",
"currency": "USD",
"vendor": {
"name": "Ridgeback Print Co.",
"tax_id": "47-3851902"
},
"customer": {
"name": "Larkhaven Coffee Roasters LLC"
},
"line_items": [
{
"description": "Coffee bag labels, matte, 3 by 4 in",
"quantity": 6000,
"unit_price": 0.09,
"total": 540
},
{
"description": "Kraft gift boxes, 2-color print",
"quantity": 250,
"unit_price": 2.35,
"total": 587.5
}
],
"subtotal": 1909,
"shipping": 64,
"tax_total": 157.49,
"grand_total": 2130.49,
"amount_paid": 400,
"amount_due": 1730.49,
"payment": {
"terms": "Net 30",
"account_number": "2093 8816 4417",
"routing_number": "541030924"
}
},
"verification": {
"status": "partial",
"math_balanced": true,
"coverage": {
"values": 46,
"checked": 45
},
"checks": [
{
"kind": "line_total",
"path": "line_items[0].total",
"status": "pass",
"expected": 540,
"actual": 540,
"difference": 0,
"message": "quantity x unit price"
},
{
"kind": "line_total",
"path": "line_items[1].total",
"status": "pass",
"expected": 587.5,
"actual": 587.5,
"difference": 0,
"message": "quantity x unit price"
},
{
"kind": "sum",
"path": "subtotal",
"status": "pass",
"expected": 1909,
"actual": 1909,
"difference": 0,
"message": "the line totals"
},
{
"kind": "sum",
"path": "grand_total",
"status": "pass",
"expected": 2130.49,
"actual": 2130.49,
"difference": 0,
"message": "the line totals + tax + shipping"
},
{
"kind": "balance",
"path": "amount_due",
"status": "pass",
"expected": 1730.49,
"actual": 1730.49,
"difference": 0,
"message": "grand total less the amount paid"
},
{
"kind": "aba_routing",
"path": "payment.routing_number",
"status": "pass",
"expected": null,
"actual": "541030924",
"difference": null,
"message": "a well-formed ABA routing number"
}
]
}
}Real response from . Trimmed to the first two line items and half of the checks, with addresses, bounding boxes, empty fields and file links left out.
Every flavor on the same invoice
camelot-py 2.0.0 with pages="all". Cells give the number of tables found.
| Flavor | Scan | Text PDF | Scan after ocrmypdf |
|---|---|---|---|
| parserkit, invoice preset | 5 line items, all but 1 value checked, $0.02 | Read from the text layer, same call | No OCR step needed |
| lattice (default) | 0 | 0 | 0 |
| stream | 0 | 4 | 3 |
| network | 0 | 2 | 0 |
| hybrid | 0 | 4 | 0 |
| ml, Python 3.12 | 1, in 120 seconds | Not run | Not run |
Source: Reproduction log
Tell the two failures apart
When camelot.read_pdf(path) gives you <TableList n=0>, look at stderr first. If camelot/parsers/base.py line 132 prints "UserWarning: page-1 is image-based, camelot only works on text-based pages.", the PDF has no text layer, and as the docs put it, Camelot "will report zero tables found." Switching to stream, network, hybrid, or auto won't help because they all need text and will return n=0 with the same warning.
If you get <TableList n=0> and no warning at all, the PDF has text, so the problem is the parser flavor. On a borderless table like invoice-ridgeback-v-digital.pdf, pass flavor="stream" or flavor="hybrid", both of which found 4 tables in our run.
What parserkit does with the scan
We sent invoice-ridgeback-v-scan.pdf to the parse API with the invoice preset. Pages with a text layer are read from it and pages without one go through OCR, and the job counts them in digital_pages and ocr_pages. Because the file is a scan, the API read the 1 page by OCR, extracted all 5 line items, and finished with status succeeded. Validation came back partial: all 12 checks passed, and the one unchecked value was payment.account_number, because a plain bank account number has no checksum rule.
A 1-page invoice like this costs $0.02, and $0.01 a page past 5,000 pages in a UTC month; failed jobs and exact duplicates cost nothing. Google sign-in gives you $1 in free credit, 50 pages with no card. Details are on the pricing page.
FAQ
Common questions
Why does camelot read_pdf return TableList n=0?
Either the PDF is a scan with no text layer (which prints "UserWarning: page-1 is image-based, camelot only works on text-based pages."), or the table has no cell borders and you're using the default lattice flavor. For a text PDF without borders, pass flavor="stream"; for a scan, add a text layer with OCR or install the ml extras for flavor="ml". parserkit reads both kinds of page in one call, scans through OCR, at $0.02 a page.
Does Camelot need Ghostscript?
Not anymore. Ghostscript and poppler are optional backends, and "as of v1.0.0 ghostscript is replaced by pdfium as the default image conversion backend." A plain install of camelot-py 2.0.0 needs no system dependencies. parserkit needs no install at all: one POST /v1/parse call reads the PDF, scans included.
Can Camelot read scanned PDFs?
The Camelot FAQ states, "No, Camelot only works with text-based PDFs and not scanned documents." In camelot-py 2.0.0, you have to either run an OCR tool like ocrmypdf before stream or install the [ml] and [ocr] extras on Python 3.12 to use flavor="ml", which took 120 seconds on CPU for our 1-page scan. parserkit read that scan by OCR in one call and checked 45 of its 46 values, for $0.02.
Is there a free Camelot alternative for scanned PDFs?
Camelot itself is free, but its only scan route is flavor="ml", and the ml and ocr extras it needs failed to install on Python 3.13 for us. parserkit reads scans with OCR in the same call as text PDFs and gives you 50 pages free on Google sign-in, no card.
Related
- tabula read_pdf returns []tabula-py gives an empty list on scans and JavaNotFoundError without Java. Both reproduced, the fix for each, and parserkit reading the scan.
- extract_text returns emptypdfplumber and pypdf return '' on scanned PDFs. Spot a scan in one line, then let parserkit read it with OCR and checked totals.
- PDF table extraction APITables from PDFs and scans as JSON, Excel and CSV, whole across page breaks.
- PDF table extraction toolsparserkit leads for PDF tables to Excel, CSV and JSON at $0.02 a page, ahead of Tabula, Camelot and AWS Textract.
- Invoice parser APILine items, taxes and totals as JSON, with every sum re-added.
- PDF to Excel converterPull the tables out of a PDF, digital or scanned, into Excel with the printed column names, free and without an account.
- PDF to JSON converterTurn the tables in a PDF into JSON rows with typed columns and the page of every row, free without an account.
Start free
Send us your worst scan
Your first $1 is free: 50 pages with every check and export, no card.
