# PDF Parser API (`george.the.developer/pdf-parser-api`) Actor

Instant API that parses any PDF from a URL — extracts full text, page count, metadata (title, author, dates), and PDF version. Returns structured JSON. Perfect for document processing pipelines and AI agents.

- **URL**: https://apify.com/george.the.developer/pdf-parser-api.md
- **Developed by:** [George Kioko](https://apify.com/george.the.developer) (community)
- **Categories:** Developer tools
- **Stats:** 5 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 pdf-parseds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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 Parser API - Extract Text & Metadata from PDF Files

A fast, reliable **PDF parser API** that extracts text content, metadata, page count, and word count from any publicly accessible PDF file. Simply provide a PDF URL and get back structured JSON with the full text and document properties -- perfect for **RAG pipelines**, document processing, and AI training data preparation.

Built as an always-on Standby API on [Apify](https://apify.com), it responds instantly with no cold starts, no queues, and no SDK required.

### Key Features

- **Full text extraction** -- get every word from any PDF, ready for indexing or NLP
- **Rich metadata** -- title, author, subject, creator, producer, creation/modification dates
- **Page & word counts** -- instant document statistics without downloading the file yourself
- **PDF version detection** -- know exactly what PDF spec the document uses
- **GET and POST endpoints** -- use query parameters or JSON body, your choice
- **CORS enabled** -- call directly from browser-based apps
- **Magic-byte validation** -- rejects non-PDF files before wasting parse time
- **Password-protected detection** -- returns a clear error instead of crashing
- **Streaming size guard** -- enforces the 50 MB limit even when Content-Length is missing

### How It Works

```mermaid
flowchart LR
    A["Client\n(curl / Python / JS)"] -->|HTTP GET or POST\nwith PDF URL| B["PDF Parser API\n(Apify Standby)"]
    B -->|Download PDF| C["Remote PDF\nServer"]
    C -->|PDF binary| B
    B -->|pdf-parse\nprocessing| D["Extracted Data"]
    D -->|JSON response| A

    style A fill:#e8f4fd,stroke:#2196F3
    style B fill:#fff3e0,stroke:#FF9800
    style C fill:#f3e5f5,stroke:#9C27B0
    style D fill:#e8f5e9,stroke:#4CAF50
````

### Endpoints

| Method | Path | Description |
|--------|------|-------------|
| `GET` | `/parse?url=<pdf_url>` | Parse a PDF by passing the URL as a query parameter |
| `POST` | `/parse` | Parse a PDF by sending `{"url": "<pdf_url>"}` as JSON body |
| `GET` | `/health` | Health check -- returns `{"status": "ok"}` |
| `GET` | `/` | Service info with usage instructions |

### Input

#### GET request

Pass the PDF URL as a query parameter:

```
GET /parse?url=https://example.com/document.pdf
```

#### POST request

Send a JSON body with the `url` field:

```json
{
  "url": "https://example.com/document.pdf"
}
```

### Output

A successful response returns structured JSON:

```json
{
  "success": true,
  "pages": 12,
  "text": "Full extracted text content of the PDF document...",
  "metadata": {
    "title": "Annual Report 2025",
    "author": "Jane Smith",
    "subject": "Financial Summary",
    "creator": "Microsoft Word",
    "producer": "macOS Quartz PDFContext",
    "creationDate": "D:20250115102030Z",
    "modDate": "D:20250120083000Z"
  },
  "pdfVersion": "1.7",
  "textLength": 48320,
  "wordCount": 7841,
  "processingTimeMs": 342
}
```

#### Error response

```json
{
  "success": false,
  "error": "PDF is password-protected and cannot be parsed."
}
```

### How to Use

#### Using curl (GET)

```bash
curl "https://pdf-parser-api.apify.actor/parse?url=https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
```

#### Using curl (POST)

```bash
curl -X POST "https://pdf-parser-api.apify.actor/parse" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"}'
```

#### Health check

```bash
curl "https://pdf-parser-api.apify.actor/health"
```

### Integration Examples

#### Python

```python
import requests

response = requests.get(
    "https://pdf-parser-api.apify.actor/parse",
    params={"url": "https://example.com/report.pdf"}
)
data = response.json()

print(f"Pages: {data['pages']}")
print(f"Words: {data['wordCount']}")
print(f"Title: {data['metadata']['title']}")
print(f"Text preview: {data['text'][:500]}")
```

#### Node.js

```javascript
const response = await fetch("https://pdf-parser-api.apify.actor/parse", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    url: "https://example.com/report.pdf",
  }),
});

const data = await response.json();
console.log(`Pages: ${data.pages}`);
console.log(`Words: ${data.wordCount}`);
console.log(`Text preview: ${data.text.slice(0, 500)}`);
```

#### RAG Pipeline (Python + LangChain)

```python
import requests
from langchain.text_splitter import RecursiveCharacterTextSplitter

## Extract text from PDF
resp = requests.get(
    "https://pdf-parser-api.apify.actor/parse",
    params={"url": "https://example.com/knowledge-base.pdf"}
)
pdf_data = resp.json()

## Chunk for vector store
splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
chunks = splitter.split_text(pdf_data["text"])

## Each chunk is ready for embedding and indexing
print(f"Split {pdf_data['wordCount']} words into {len(chunks)} chunks")
```

### Use Cases

- **RAG pipelines** -- extract text from PDFs and chunk it for vector databases (Pinecone, Weaviate, Chroma)
- **Document processing** -- batch-process invoices, contracts, and reports into structured data
- **AI training data** -- convert PDF corpora into clean text for fine-tuning language models
- **Legal & compliance** -- parse regulatory filings, court documents, and compliance reports at scale
- **Academic research** -- extract text from research papers for citation analysis or literature reviews
- **Content migration** -- pull text from legacy PDF archives into modern CMS platforms
- **Search indexing** -- feed PDF content into Elasticsearch, Algolia, or Meilisearch

### Pricing

| Event | Cost |
|-------|------|
| PDF parsed successfully | **$0.004** per PDF |

You only pay when a PDF is successfully parsed. Failed requests (invalid URL, timeout, password-protected files) are not charged.

### Limitations

| Constraint | Limit |
|------------|-------|
| Maximum file size | **50 MB** |
| Download timeout | **60 seconds** |
| Request body size | **1 MB** (for POST requests) |
| Scanned PDFs | **No OCR** -- only digitally created PDFs with embedded text are supported |
| Password-protected PDFs | **Not supported** -- returns a clear error message |
| Protocols | **HTTP and HTTPS only** -- no local file paths or FTP |

### FAQ

#### Does this API support scanned PDFs or images inside PDFs?

No. This API extracts embedded text from digitally created PDFs. If a PDF was created by scanning paper documents and contains only images, the extracted text will be empty or minimal. For scanned PDFs, you would need an OCR service as a preprocessing step.

#### What happens if the PDF is too large or the download times out?

The API enforces a 50 MB file size limit and a 60-second download timeout. If either limit is exceeded, you will receive a clear error response with the appropriate HTTP status code (413 for size, 408 for timeout). You are not charged for failed requests.

#### Can I parse PDFs that require authentication or are behind a login?

The API fetches PDFs from the URL you provide using a standard HTTP request. If the PDF requires cookies, authentication headers, or is behind a login wall, the download will likely fail. The PDF must be publicly accessible or accessible via a direct URL with any required tokens embedded in the query string.

#### What metadata fields are extracted?

The API extracts seven metadata fields when available: **title**, **author**, **subject**, **creator** (the application that created the document), **producer** (the PDF library used), **creation date**, and **modification date**. Not all PDFs contain all metadata fields -- missing fields are returned as `null`.

***

Built by [George The Developer](https://apify.com/george.the.developer) on Apify.

# Actor input Schema

## `url` (type: `string`):

Direct URL to a PDF file to parse.

## Actor input object example

```json
{
  "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
}
```

# 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 = {
    "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
};

// Run the Actor and wait for it to finish
const run = await client.actor("george.the.developer/pdf-parser-api").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 = { "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" }

# Run the Actor and wait for it to finish
run = client.actor("george.the.developer/pdf-parser-api").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
}' |
apify call george.the.developer/pdf-parser-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=george.the.developer/pdf-parser-api",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "PDF Parser API",
        "description": "Instant API that parses any PDF from a URL — extracts full text, page count, metadata (title, author, dates), and PDF version. Returns structured JSON. Perfect for document processing pipelines and AI agents.",
        "version": "1.0",
        "x-build-id": "ZevdWt8Q72QWPuvDI"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/george.the.developer~pdf-parser-api/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-george.the.developer-pdf-parser-api",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/george.the.developer~pdf-parser-api/runs": {
            "post": {
                "operationId": "runs-sync-george.the.developer-pdf-parser-api",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/george.the.developer~pdf-parser-api/run-sync": {
            "post": {
                "operationId": "run-sync-george.the.developer-pdf-parser-api",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "url"
                ],
                "properties": {
                    "url": {
                        "title": "PDF URL",
                        "type": "string",
                        "description": "Direct URL to a PDF file to parse."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
