PDF Table and Text Extractor: Tables to JSON, CSV, Markdown avatar

PDF Table and Text Extractor: Tables to JSON, CSV, Markdown

Pricing

$1.00 / 1,000 page reads

Go to Apify Store
PDF Table and Text Extractor: Tables to JSON, CSV, Markdown

PDF Table and Text Extractor: Tables to JSON, CSV, Markdown

Extract tables and text from PDF files. Tables keep their rows and columns, as JSON, CSV and Markdown. Handles ruled and borderless tables, tables across pages, and CJK text. Pay per page read. Scanned pages and failed files are free.

Pricing

$1.00 / 1,000 page reads

Rating

0.0

(0)

Developer

のうてん 農園

のうてん 農園

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

2 days ago

Last modified

Categories

Security

Limited permissions

Share

PDF Table and Text Extractor

Get the tables and the text out of a PDF, such as financial statements, statistical reports, price lists and government data. Give it a PDF link, and get each table back as JSON, CSV (which opens in Excel) and Markdown, plus the text of each page.

General PDF text extractors tend to flatten a table into lines of text, which loses track of which value belongs to which column. This Actor keeps that structure, and gives you the plain text as well.

Quick start

  1. Paste one or more PDF links into PDF URLs. The prefilled example works as it is.
  2. Click Start.
  3. Open the Results view, or export the dataset.

Choose Text only if you don't need tables. It is faster, and costs the same per page.

Here is one table from the output:

{
"recordType": "table",
"page": 1,
"rowCount": 3,
"columnCount": 4,
"headers": ["Region", "Q1", "Q2", "Total"],
"rows": [{ "Region": "North", "Q1": "1,200", "Q2": "1,350", "Total": "2,550" }],
"csv": "Region,Q1,Q2,Total\nNorth,\"1,200\",\"1,350\",\"2,550\"\n"
}

What it does

  • Finds tables drawn with ruling lines, and tables that only line up by their text
  • Joins a table that runs over several pages into one table, and removes repeated header rows
  • Separates rows that the PDF stacks inside one cell, which is common in statistical reports
  • Reads tables on sideways pages, and text the PDF draws twice to fake bold
  • Sets aside title rows and footnotes in caption and notes, so they don't end up in your data
  • Keeps blank cells in place, so values stay in the right column
  • Joins text that wraps inside a cell, with correct handling of Japanese and Chinese
  • Skips ordinary paragraphs, page frames and charts instead of reporting them as tables
  • Reads text in order on two-column pages, so the left and right columns don't get mixed together

How accurate is it?

We measured table extraction on the ICDAR 2013 table competition set (67 real PDFs with 156 human-checked tables), scoring which cell sits next to which.

ToolFinds (recall)Correct (precision)F1
This Actor0.9080.9140.911
Camelot 2.0 hybrid, default settings0.8610.7470.800
Camelot 2.0 network, default settings0.7850.8020.794
Camelot 2.0 stream, default settings0.8600.6850.762
Camelot 2.0 lattice, default settings0.2270.9410.366

This Actor was improved using the same set, so expect lower scores on your own files. About 6 in 10 of the documents scored 90% or better on both measures. The rest had some cells misplaced or missed, so check any figures that matter.

What it does not do

  • Scanned PDFs: files with no text layer need OCR first. They return no_text_layer, and you are not charged.
  • Password-protected PDFs are not supported.
  • Multi-row and merged headers: these are not rebuilt. The item includes a warning when many header cells are blank.
  • Columns set very close together: these may be merged into one column.
  • Tables next to charts: on a busy page, a table beside a chart may be missed.
  • Pages with three or more columns: the text is read straight across, so the columns get mixed. The text of a table also reads straight across, row by row.

Input

{
"pdfUrls": ["https://example.com/report.pdf"],
"content": "both",
"pages": "1-3, 5",
"strategy": "auto",
"firstRowIsHeader": true
}

Output

content can be both, tables or text. Each table is one dataset item:

{
"recordType": "table",
"sourceUrl": "https://example.com/report.pdf",
"tableIndex": 1,
"page": 1,
"pages": [1, 2],
"tableIndexOnPage": 1,
"strategy": "lines",
"rowCount": 3,
"columnCount": 4,
"caption": "Monthly report",
"notes": null,
"headers": ["Region", "Q1", "Q2", "Total"],
"rows": [{ "Region": "North", "Q1": "1,200", "Q2": "1,350", "Total": "2,550" }],
"cells": [["Region", "Q1", "Q2", "Total"], ["North", "1,200", "1,350", "2,550"]],
"markdown": "| Region | Q1 | Q2 | Total |\n| --- | --- | --- | --- |\n| North | 1,200 | 1,350 | 2,550 |",
"csv": "Region,Q1,Q2,Total\nNorth,\"1,200\",\"1,350\",\"2,550\"\n",
"boundingBox": [72.0, 72.0, 523.3, 150.0],
"warnings": []
}

A very large table includes only the csv field, with a warning, because dataset items have a size limit.

Each page with text is one item, with recordType, sourceUrl, page and text.

Each PDF also gets one item with "recordType": "status". Its status is one of:

StatusMeaningCharged
okTables or text were foundPer page read
no_tablesWith tables only: the file was read, and no tables were foundNo
no_text_layerThe file looks scannedNo
failedThe file could not be downloaded or read. See messageNo
spending_limitYour spending limit doesn't cover this file's pages, so its tables are not included and the run stopsNo

Pricing

You pay per page that has text, whether you ask for tables, text or both. Use the pages input to read only the pages you need. Scanned pages and files that fail are free. With tables only, a file with no tables is free too. The pagesCharged field in each file's status shows how many pages you paid for.

Your responsibility

Only process documents you have the right to use. Do not send confidential documents through public URLs.