New Tool Radar

AI PDF

How to Extract a Borderless Table from a PDF with Camelot Stream and Check Every Cell

Extract a borderless table with Camelot stream mode and compare every cell with the page.

Schematic with three steps: Extract with stream mode; Check the column alignment; Compare every cell with the page.

Many PDFs have tables with no ruling lines at all, just columns of text held apart by white space. Camelot’s stream mode reads those tables by looking at the gaps between text, but white space is a weaker signal than a line, so the columns can drift and a value can land in the wrong column.

What you need

  • Python with Camelot installed
  • A PDF with a borderless table
  • The table as printed on the page, to compare against

Step 1: Extract with stream mode

Run camelot.read_pdf(“file.pdf”, flavor=”stream”) and export the first table to a CSV file. Stream mode suits tables without ruling lines.

Step 2: Check the column alignment

Open the CSV and check that each value sits in the right column. A value that has drifted left or right is the most common stream-mode error.

Step 3: Compare every cell with the page

Read the CSV row by row against the PDF page. If the columns are wrong, adjust the table areas or the row tolerance and extract again.

Worked example: synthetic stream extraction of a borderless price list

The table below is a synthetic example. It shows the expected result of extracting a borderless table; no extraction was run.

Cell On the page In the CSV
Row 1, Item Paper clips Paper clips
Row 1, Price 2.40 2.40
Row 2, Item Stapler Stapler
Row 2, Price 8.99 8.99

Expected result (UNTESTED). all 4 checked cells match the page, so the stream extraction aligned the columns correctly for this table. Check the remaining rows before using the CSV, because column drift often appears further down the page. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • Stream mode depends on consistent white space, so uneven column gaps can merge or split columns.
  • Camelot reads only the first page by default, so set the pages argument for a table on another page.
  • Numbers with spaces, such as 1 000, can be split across two cells by stream mode.

Sources

See all