# PDF Tables & Text to JSON and CSV (`abdulwhab95/pdf-tables-text-to-json-csv`) Actor

Extract tables and text from public text-based PDFs. One result per page, with table arrays and CSV strings. Choose line-based or whitespace-based table detection. No OCR service or external API key.

- **URL**: https://apify.com/abdulwhab95/pdf-tables-text-to-json-csv.md
- **Developed by:** [ABDULWAHAB NASER RASHED ALQARAWI](https://apify.com/abdulwhab95) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 text-bearing pdf pages

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## PDF Tables & Text to JSON and CSV

Enter public URLs of text-based PDF files and choose how many pages to extract.\
Get text and detected tables for each text-bearing page, including table CSV strings; scanned pages need OCR and are skipped.

### Combined limits and numeric CSV

The 15 MB per-file and 5-file settings are separate caps: the entire run still has a 40 MB aggregate download budget including robots and redirects, so five 15 MB PDFs cannot all fit. PDF opening, page-tree loading, text and table extraction run off the event loop; the 240-second processing deadline still bounds the run. Plain negative numeric CSV cells remain numeric-looking; spreadsheet formulas remain escaped. No OCR is provided.

### Real output example

Captured on 2026-09-14 from run `j6Kvi3OsIJ02K4Wrh` using the input below. Selected fields are shown; long values are shortened with an ellipsis. Live source data can change.

| page | documentPages | tableCount | text |
| --- | --- | --- | --- |
| 1 | 1 | 1 | NICS Firearm Background Checks November - 2015 Pre-Pawn Redemption Returned/Disposition Rentals Private Sale Return to S… |

### Quick start

1. Leave the prefilled example in place and click **Start** for a small first run. Replace it with your own source when ready.
2. Set **Maximum delivered results** and Apify's **Maximum cost per run**.
3. Run the Actor. Export the dataset as JSON, CSV or Excel. Open **Run report** for errors, skipped items and limits.

```json
{
  "urls": [
    "https://raw.githubusercontent.com/jsvine/pdfplumber/stable/examples/pdfs/background-checks.pdf"
  ],
  "maxPagesPerPdf": 1,
  "tableStrategy": "lines",
  "maxResults": 1
}
```

### What it supports

Up to 5 public PDF URLs, 15 MB each, and 20 pages per PDF (5 by default). Lines mode works for ruled tables; text mode infers columns from whitespace. No OCR: scanned/image-only pages are skipped with a warning and no result fee. Text pages without a table still return their text and are billed. Password-protected files are not supported. Each result includes table rows and tablesCsv strings; CSV cells starting with formula markers are escaped for spreadsheet safety. Extraction can need manual checking for merged cells or complex layouts. The result explicitly marks a document cut off by the page cap.

### Price

**$0.0100 per text-bearing PDF page ($10 per 1,000)**, plus **$0.001 per run start** at the supported 512 MB–1 GB memory sizes. The custom `result` event is charged only for a delivered dataset row. There is no separate automatic dataset-row fee. A run that returns zero rows still incurs the start fee. Your account's displayed pricing and platform terms apply. Actor authors pay their own platform resource costs during development and testing.

Set the maximum cost in Apify to cap spending. maxResults also limits output. A limit may truncate a catalog or comparison; inspect RUN\_REPORT rather than assuming completeness.

### Output and reliability

Main fields: `url`, `page`, `documentPages`, `tableCount`, `tables`, `tablesCsv`, `text`. Each row includes `observedAt`. Nested values remain JSON; choose JSON export to preserve all detail.

RUN\_REPORT contains result count, HTTP request/download totals, source errors, skipped unchanged items and final status. PARTIAL means at least one source failed while other rows were delivered. FAILED means no successful result and at least one error. Successful empty feeds or no-change comparisons can legitimately return zero rows. A 240-second processing deadline and Apify's run timeout bound execution. Downloads are limited to 40 MB per run, with smaller per-response caps; robots checks count as requests. No proxy or external AI API subscription is required.

Only public pages and documented public APIs are supported. Access restrictions are reported. The crawler does not send your Apify token to target websites or connect to private network addresses. Use sources you are entitled to access. Static HTML tools do not execute website JavaScript.

### Repeated runs

For Actors with `stateStoreName`, use a distinct name for each collection and keep the same name for later runs. Apify creates that store in your account; storage retention and access follow your account settings. Do not start overlapping runs that share a store. `onlyChanges` emits new/updated items and retains at most 10,000 recent fingerprints. It does not infer removed pages/jobs. Other Actors are stateless: supply fresh inputs, or feed their datasets into the Dataset Change Detector.

Apify tasks, schedules and integrations can reuse this input. No recurring schedule or customer notification is created automatically.

### عربي

أداة جاهزة للتشغيل من واجهة Apify أو API. أدخل الروابط أو البيانات، وحدد عدد النتائج والحد الأعلى للتكلفة. النتائج بصيغ JSON وCSV وExcel، والتفاصيل والأخطاء في RUN\_REPORT. البيانات العامة فقط؛ الحقول غير المتوفرة تبقى فارغة. راجع حدود الأداة أعلاه قبل اعتماد النتائج.

# Actor input Schema

## `urls` (type: `array`):

Public HTTP(S) URLs without credentials.

## `maxPagesPerPdf` (type: `integer`):

Integer from 1 to 20.

## `tableStrategy` (type: `string`):

Lines for ruled tables; text for whitespace-separated columns.

## `maxResults` (type: `integer`):

Integer from 1 to 5000.

## `maxRequests` (type: `integer`):

Integer from 1 to 300.

## Actor input object example

```json
{
  "urls": [
    "https://raw.githubusercontent.com/jsvine/pdfplumber/stable/examples/pdfs/background-checks.pdf"
  ],
  "maxPagesPerPdf": 1,
  "tableStrategy": "lines",
  "maxResults": 1,
  "maxRequests": 100
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `runReport` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "https://raw.githubusercontent.com/jsvine/pdfplumber/stable/examples/pdfs/background-checks.pdf"
    ],
    "maxPagesPerPdf": 1,
    "tableStrategy": "lines",
    "maxResults": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("abdulwhab95/pdf-tables-text-to-json-csv").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "urls": ["https://raw.githubusercontent.com/jsvine/pdfplumber/stable/examples/pdfs/background-checks.pdf"],
    "maxPagesPerPdf": 1,
    "tableStrategy": "lines",
    "maxResults": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("abdulwhab95/pdf-tables-text-to-json-csv").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "https://raw.githubusercontent.com/jsvine/pdfplumber/stable/examples/pdfs/background-checks.pdf"
  ],
  "maxPagesPerPdf": 1,
  "tableStrategy": "lines",
  "maxResults": 1
}' |
apify call abdulwhab95/pdf-tables-text-to-json-csv --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,abdulwhab95/pdf-tables-text-to-json-csv"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/ooHe0F3huuwyUJfMB/builds/p41skrTgCbgQaVtli/openapi.json
