# PDF to Text Extractor: Pages, Metadata & RAG Chunks (`ravensource/pdf-text-extractor`) Actor

Extract text from PDF files by URL: full text, per-page text, metadata and RAG-ready chunks, with scanned-page detection. Pay only for PDFs that succeed. Export CSV/JSON or connect n8n, Make, Zapier and LangChain.

- **URL**: https://apify.com/ravensource/pdf-text-extractor.md
- **Developed by:** [RavenSource](https://apify.com/ravensource) (community)
- **Categories:** Developer tools, AI, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 pdf processeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

**PDF to Text Extractor** turns PDF files into clean text. Give it PDF URLs and get, for each file, the **full text**, **text per page**, **document metadata** and, if you want them, **overlapping chunks that remember their page numbers** for RAG. It is a simple **PDF to text** API for bulk **PDF text extraction**: no browser, no API key, no setup.

Scanned pages are **detected and flagged** instead of silently coming back empty, and you **pay only for PDFs that succeed**: a flat price per extracted PDF, whatever its length. Failed downloads, non-PDF links, encrypted files and scans without text cost nothing.

- **Full text and per-page text**, so every sentence can be traced to its page.
- **Metadata**: title, author, subject, keywords, creator, producer, creation and modification dates in ISO 8601.
- **RAG-ready chunks** with `pageStart` and `pageEnd`, cut at word boundaries, with the overlap you choose.
- **Scanned-page detection**: `likelyScanned` per page, `scannedPageCount` per PDF, and a clear status for PDFs with no text at all.
- **One row per URL, always**: each input gets a dataset item with a status, so nothing disappears from a batch.
- **Export** to JSON, CSV, Excel or HTML, or use it from **n8n, Make, Zapier, LangChain and LlamaIndex**.

### What does PDF to Text Extractor do?

It downloads each PDF, reads its text layer with PDFium (the open-source PDF engine of Chromium) and writes one dataset item per URL. It extracts text from PDF files that contain text: reports, papers, contracts, statements, manuals, forms, filings.

It does **not** run OCR. A scanned PDF is an image of text; this Actor tells you which pages and which files are scans, so you can send only those to an OCR tool. It also does not convert tables to structured data or produce Markdown: the output is plain text, in reading order as stored in the file.

### Who is PDF to Text Extractor for?

- **RAG and LLM pipelines.** Load reports and manuals into a vector database with chunks that carry their page range, so answers can cite the page.
- **Search indexing.** Make the PDFs of a site, an intranet export or a document archive searchable.
- **Compliance and document review.** Pull the text of contracts, policies, filings and disclosures, with a SHA-256 of each file and its metadata dates.
- **Research and lead lists.** Turn a list of annual reports, tenders, studies or whitepapers into text you can filter and analyse.

### How to extract text from PDF files

1. Open the Actor and paste your PDF links into **PDF URLs**, or link a text file with one URL per line.
2. Optional: set **Chunk size** (for example 1500) if you want chunks, and **Maximum pages per PDF** if you only need the beginning of long files.
3. Click **Start**. Small PDFs take about a second each, and several are processed in parallel.
4. Open the **Output** tab. *Overview* has one row per PDF; *Pages* and *Chunks* have one row per page or chunk.
5. Download the dataset as JSON, CSV or Excel, or fetch it through the API. Schedule the Actor or call it from your workflow tool to run it regularly.

### Input

The Input tab describes every field. The ones you are most likely to use:

| Field | What it does | Default |
|---|---|---|
| `pdfUrls` | Required. Direct `http(s)` links to PDF files, as `[{"url": "..."}]`. Also accepts Apify key-value store record URLs and a remote text file with one URL per line. Up to 20,000 per run. | one sample PDF |
| `maxFileSizeMb` | Largest PDF to download. Bigger files get status `TOO_LARGE`. | 50 |
| `maxPages` | Maximum pages extracted per PDF. | 500 |
| `pageLimitBehavior` | `truncate`: extract the first `maxPages` pages and flag the item. `skip`: report `TOO_MANY_PAGES` instead. | `truncate` |
| `pageRange` | Extract only some pages of every PDF, for example `1-5,8,12-`. | all pages |
| `includePageTexts` | Add the `pages` array. Turn off to halve the item size. | `true` |
| `chunkSize` / `chunkOverlap` | Chunk length and overlap in characters. `0` turns chunking off. | `0` / `200` |
| `password` | Password for encrypted PDFs (stored encrypted). | none |
| `maxConcurrency` | PDFs processed in parallel; lowered automatically to fit the run's memory. | 2 |
| `requestTimeoutSecs` / `perDocumentTimeoutSecs` | Time limits for downloading and for extracting one PDF. | 60 / 120 |
| `proxyConfiguration` | Optional proxy for downloads. | no proxy |

Example input:

```json
{
  "pdfUrls": [
    { "url": "https://www.govinfo.gov/content/pkg/BILLS-118hr82enr/pdf/BILLS-118hr82enr.pdf" },
    { "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf" }
  ],
  "maxPages": 200,
  "chunkSize": 1500,
  "chunkOverlap": 200
}
```

Link to the PDF file itself, not to a viewer page around it: a page that only shows the PDF comes back as `NOT_PDF`.

### Output: PDF to JSON, one row per file

You can download the dataset in various formats such as JSON, HTML, CSV or Excel. Every URL that is processed produces exactly one item. A real item from the example input above, with the long text fields shortened (`...`):

```json
{
  "url": "https://www.govinfo.gov/content/pkg/BILLS-118hr82enr/pdf/BILLS-118hr82enr.pdf",
  "finalUrl": "https://www.govinfo.gov/content/pkg/BILLS-118hr82enr/pdf/BILLS-118hr82enr.pdf",
  "status": "OK",
  "charged": true,
  "fileName": "BILLS-118hr82enr.pdf",
  "fileSizeBytes": 110369,
  "sha256": "877be157d555c02e4e5db6d8e5eb81f11001035e2b9348a7c4b8990e45040c5d",
  "pageCount": 2,
  "pagesExtracted": 2,
  "truncated": false,
  "scannedPageCount": 0,
  "charCount": 2435,
  "wordCount": 377,
  "metadata": {
    "title": null,
    "author": null,
    "subject": null,
    "keywords": null,
    "creator": "ACOMP.exe   WinVer 2.2a  Sep 11 2014",
    "producer": "Acrobat Distiller 24.0 (Windows); modified using iText® Core 7.2.3 (production version) ©2000-2022 iText Group NV, Government Publishing Office",
    "creationDate": "2024-12-23T10:53:24-05:00",
    "modDate": "2024-12-27T06:17:55Z"
  },
  "pdfVersion": "1.5",
  "text": "H. R. 82\nOne Hundred Eighteenth Congress\nof the\nUnited States of America\nAT THE SECOND SESSION\n...",
  "pages": [
    { "pageNumber": 1, "text": "H. R. 82\nOne Hundred Eighteenth Congress\n...", "charCount": 2254, "likelyScanned": false },
    { "pageNumber": 2, "text": "H. R. 82—2\nnecessary to take into account the amendments made by section\n3.\n...", "charCount": 181, "likelyScanned": false }
  ],
  "chunks": [
    { "chunkIndex": 0, "text": "H. R. 82\nOne Hundred Eighteenth Congress\n...", "charCount": 1497, "pageStart": 1, "pageEnd": 1 },
    { "chunkIndex": 1, "text": "(k)(5), subsection (q)’’ and\ninserting ‘‘subsection (q)’’.\nSEC. 3. ...", "charCount": 1139, "pageStart": 1, "pageEnd": 2 }
  ],
  "textTruncatedInDataset": false,
  "fullTextUrl": null,
  "skippedPages": [],
  "warnings": [],
  "error": null,
  "processedAt": "2026-11-22T01:24:58Z"
}
```

What the fields mean:

| Field | Meaning |
|---|---|
| `status`, `error` | Outcome of this URL (table below). `error` is `null` for `OK`, otherwise `{code, message}` with a plain explanation. |
| `charged` | `true` when this item was billed. Only `OK` items are. |
| `text` | The full text. Pages are separated by a form feed character (`\f`), so `text.split("\f")` gives the pages. |
| `pages` | `[{pageNumber, text, charCount, likelyScanned}]`. `pageNumber` is the position in the file, starting at 1. |
| `chunks` | `[{chunkIndex, text, charCount, pageStart, pageEnd}]` when `chunkSize` is above 0, otherwise `null`. |
| `pageCount`, `pagesExtracted`, `truncated` | Pages in the file, pages extracted, and whether the page cap or the output size limit cut the extraction short. |
| `scannedPageCount` | Extracted pages that look scanned. |
| `charCount`, `wordCount` | Size of the extracted text. |
| `metadata`, `pdfVersion` | The PDF's document information; dates are ISO 8601 and keep the time zone when the PDF recorded one. |
| `finalUrl`, `fileName`, `fileSizeBytes`, `sha256` | Where the file really came from after redirects, and what was downloaded. |
| `textTruncatedInDataset`, `fullTextUrl` | See "Very large PDFs" below. |
| `skippedPages`, `warnings` | Pages that could not be processed in this run's memory, and notes about truncation. |

The text is cleaned lightly: Unix line breaks, no control characters, no trailing spaces, and words hyphenated across a line break are joined again. Only text inside the visible page area is returned.

#### Statuses: what happened to each URL

| `status` | Meaning | Charged |
|---|---|---|
| `OK` | Text was extracted. | **Yes** |
| `NO_TEXT_LIKELY_SCANNED` | The PDF has no extractable text. Usually a scan: it needs OCR. | No |
| `TOO_LARGE` | The file is bigger than `maxFileSizeMb`, or needs more memory than the run has. | No |
| `TOO_MANY_PAGES` | More pages than `maxPages`, with `pageLimitBehavior` set to `skip`. | No |
| `NO_PAGES_IN_RANGE` | `pageRange` selects no page that exists in this PDF. | No |
| `NOT_PDF` | The URL returned something else, for example an HTML page. | No |
| `DOWNLOAD_FAILED` | HTTP error, DNS or connection problem, too many redirects, or the download timed out. | No |
| `BLOCKED_URL` | The URL points to a private or internal address, uses a port that is not allowed, or contains credentials. | No |
| `ENCRYPTED` | The PDF needs a password and none, or a wrong one, was given. | No |
| `PARSE_FAILED` | The file is damaged or not a valid PDF. | No |
| `TIMEOUT` | Extraction took longer than `perDocumentTimeoutSecs`. | No |
| `INVALID_URL` | Not a valid `http(s)` URL. | No |

A run finishes successfully even when some URLs fail: read `status` per item. The `OUTPUT` record of the run's key-value store holds the totals: counts by status, PDFs charged, pages, bytes, whether the spending limit has been reached, and URLs that were not processed.

With `maxConcurrency` above 1, rows are written as PDFs finish, which is not always the input order. Match rows to your input by `url`.

### How much does it cost to extract text from PDFs?

PDF to Text Extractor uses pay-per-event pricing. There are two events and no per-page fee:

| Event | Price |
|---|---:|
| Actor start, charged by Apify once per run and per GB of memory (so once at the default 256 MB) | **$0.005** |
| PDF processed: one PDF extracted with status `OK` | **$0.0025** |

| You run | You pay |
|---|---:|
| 1 PDF | $0.0075 |
| 100 PDFs in one run | $0.255 |
| 1,000 PDFs in one run | $2.505 |
| 1,000 URLs of which 200 fail or are scans | $2.005 |

A 2-page letter and a 500-page report cost the same. Platform usage is included, so there is no separate compute bill. Put your URLs into one run rather than one run per PDF, so the start fee is paid once. You can set a maximum cost per run in Apify: the Actor checks the remaining budget before each PDF, stops cleanly when it is used up and lists the URLs it did not get to.

### Limits, and how to raise them with memory

The defaults are chosen so that a run with the default 256 MB of memory cannot run out of memory: files are streamed to disk, each PDF is parsed page by page in its own memory-limited process, and the number of parallel PDFs follows the memory of the run.

| Run memory | PDFs in parallel (at most) | Memory per PDF when 2 run in parallel | Largest output per PDF |
|---:|---:|---:|---:|
| 128 MB | 1 | 43 MB | 8 MB |
| **256 MB (default)** | **2** | **72 MB** | **16 MB** |
| 512 MB | 5 | 190 MB | 32 MB |
| 1024 MB | 8 | 426 MB | 64 MB |
| 2048 MB | 10 | 898 MB | 128 MB |
| 4096 MB | 16 | 1,922 MB | 128 MB |

What that means in practice at 256 MB: PDFs of a few hundred to a few thousand pages work (extracting a 1,039-page bill takes about 1.3 s of CPU and 28 MB of memory), and files up to the default 50 MB are downloaded and parsed without trouble. Give the run more memory (Run options → Memory) when:

- an item has `skippedPages`: a page with a very complex drawing needed more memory than one PDF gets. In our tests such a page needed about 430 MB; it is extracted with 2048 MB, or with 1024 MB and `maxConcurrency` set to 1;
- an item is `truncated` with a warning about the output size: the text of that PDF is larger than the limit in the last column;
- you get `TIMEOUT` on very long PDFs: CPU share grows with memory, so more memory is also faster;
- you want to process more PDFs in parallel, or files well above the default 50 MB. `maxFileSizeMb` can be raised to 200, but disk space is twice the memory, so at 256 MB such files are processed one at a time.

128 MB is enough for small PDFs only.

#### Very large PDFs: `fullTextUrl`

A dataset row can hold about 9 MB. When the text, pages and chunks of one PDF add up to more than 5 MB, the complete item is saved as a JSON record in the run's key-value store instead. The dataset row then has `textTruncatedInDataset: true`, the first 100,000 characters in `text`, `pages` and `chunks` set to `null`, and `fullTextUrl` pointing to the record. The record has the same fields as a normal item, but its `charged` field is `null` because it is saved before billing; use the dataset row for the charge status. It is kept as long as the run's storage is kept. The PDF is still charged once.

### Scanned PDFs and OCR: scans are flagged, not OCRed

A page is marked `likelyScanned` when it has fewer than 20 characters of text and images cover part of it. That is how scanners, photocopiers and "print to image" tools produce pages.

- A PDF with some real text is `OK`; `scannedPageCount` and `pages[].likelyScanned` show which pages have no text.
- A PDF whose only "text" is a few characters on image pages (a page number or a stamp on a scan), or no text at all, is `NO_TEXT_LIKELY_SCANNED` and is **not charged**.

This Actor does not run OCR, by design: OCR is slow and priced per page. Filter the rows with `NO_TEXT_LIKELY_SCANNED` or `scannedPageCount > 0` and pass only those URLs to an OCR Actor from Apify Store. Scans that already carry a text layer from earlier OCR are extracted like any other PDF.

### Integrations and API

- **API.** Start the Actor and get the items in one call:

  ```bash
  curl -X POST "https://api.apify.com/v2/acts/ravensource~pdf-text-extractor/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"pdfUrls": [{"url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"}], "chunkSize": 1500}'
  ```

  For large batches start the run asynchronously and read the dataset when it finishes. `?view=pages` and `?view=chunks` on the dataset items endpoint return one row per page or per chunk.
- **n8n, Make, Zapier.** Use the Apify app in each tool: "Run an Actor", then "Get dataset items". A typical flow: new file link in a sheet or a webhook → PDF to Text Extractor → rows with `status` = `OK` to your database or vector store, the rest to a review list.
- **LangChain.**

  ```python
  from langchain_apify import ApifyWrapper
  from langchain_core.documents import Document

  loader = ApifyWrapper().call_actor(
      actor_id="ravensource/pdf-text-extractor",
      run_input={"pdfUrls": [{"url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"}], "chunkSize": 1500},
      dataset_mapping_function=lambda item: Document(
          page_content=item["text"] or "",
          metadata={"source": item["url"], "status": item["status"], "pages": item["pageCount"]},
      ),
  )
  documents = loader.load()
  ```

  To index chunk by chunk, map `item["chunks"]` instead and keep `pageStart` and `pageEnd` in the metadata.
- **LlamaIndex.** The `ApifyActor` reader from `llama-index-readers-apify` runs the Actor the same way; map each item, or each chunk, to a `Document`.
- **AI agents.** The Actor can be added as a tool through the Apify MCP server. Its input fields are documented with costs and limits so an agent can fill them correctly.
- **Scheduling and webhooks.** Run it on a schedule, or let a webhook notify your system when a run finishes.

### Which URLs are fetched, and what is refused

The Actor fetches exactly the URLs you give it and follows up to five redirects. Redirects from HTTPS to HTTP are blocked. It does not crawl.

To protect internal services, downloads only connect to public internet addresses over `http` or `https` on ports 80, 443, 8080 and 8443. Private, loopback, link-local and cloud metadata addresses are refused, also when a public-looking name resolves to one or a redirect points to one, and so are URLs with `user:password@`. Such URLs get status `BLOCKED_URL`. A proxy must support CONNECT and honor the validated destination address.

Direct downloads support uncompressed, gzip and deflate responses. Private record downloads must be served without content encoding.

Apify key-value store record URLs (`https://api.apify.com/v2/key-value-stores/<storeId>/records/<key>`) are read with your own run's access, so PDFs in your private stores work without a token in the URL. That is the way to process files that are not on the public web: upload them to a key-value store and pass the record URLs.

### Privacy and legal

Only process PDFs you have the right to use. You choose the URLs; the Actor downloads those files, extracts their text and stores the result in your own Apify dataset and key-value store, under your account's retention settings. Downloaded files are deleted when each PDF is done, and nothing is sent to any other service. The extracted text can contain personal data if the documents do: handle it according to the rules that apply to you, such as the GDPR. The Actor identifies itself in its User-Agent and does not try to get around access controls, logins or paywalls.

### FAQ

**Can it read scanned PDFs?**
It detects them and does not charge for PDFs without text, but it does not run OCR. See "Scanned PDFs" above.

**Can it read password-protected PDFs?**
Yes, when you put the password into `password`. The same password is tried for every PDF in the run that needs one. PDFs that only restrict printing or copying open without a password.

**Does one row mean one PDF or one page?**
One row is one PDF. Use the *Pages* or *Chunks* view of the dataset, or `?view=pages` in the API, for one row per page or per chunk.

**Why is `text` different from what I see in my PDF viewer?**
The Actor returns the text stored in the file, in the order it is stored. Multi-column layouts, tables and footnotes come out as lines of text, not as a layout. Text that is drawn as shapes or is part of an image has no text layer to extract.

**Why did I get `NOT_PDF`?**
The link returned a web page or another file type. Open the link in a browser: if you see a viewer with a download button, copy the address of the download instead.

**A host returns 403 or times out. What can I do?**
Some hosts refuse data-centre addresses. Set `proxyConfiguration` to Apify Proxy and try again; failed attempts are free. If the host needs a login, download the files yourself and pass key-value store record URLs.

**How do I process files from my computer?**
Upload them to an Apify key-value store and pass the record URLs in `pdfUrls`.

**What happens when my spending limit is reached?**
The Actor stops before starting a PDF it could not bill, finishes the ones in progress, and writes the URLs it did not process to the `OUTPUT` record under `notProcessedUrls`. Nothing is charged beyond your limit.

If a result write is interrupted, its outcome can be uncertain. The run stops and lists affected URLs under `deliveryUncertainUrls`; inspect the dataset and charges before retrying them. The saved progress prevents an automatic retry during migration or resurrection, but an interrupted URL may need manual attention.

**Is the order of pages and chunks reliable?**
Yes. `pageNumber`, `pageStart` and `pageEnd` are positions in the file, starting at 1, including covers and front matter. They are not the page labels printed on the pages.

For questions or problems, use the Issues tab and include the `status` and `error.message` of an affected row.

### Other RavenSource Actors

- [Workday Jobs Scraper: New Jobs Only Tracker](https://apify.com/ravensource/workday-jobs-scraper) returns only the job postings you have not seen before from Workday career sites.
- [App Store & Google Play Reviews Scraper](https://apify.com/ravensource/app-store-google-play-reviews) collects iOS and Android reviews into one dataset with a per-app summary.

### Changelog

- **1.0:** Text, per-page text, metadata and chunks from PDF URLs; scanned-page detection; size, page and time limits that follow the run's memory; pay only for PDFs that succeed.

# Actor input Schema

## `pdfUrls` (type: `array`):

Direct http(s) links to PDF files, one entry per PDF, for example \[{"url": "https://example.com/report.pdf"}]. Link to the file itself, not to a viewer page. Redirects are followed (up to 5). Each PDF that is extracted successfully is charged once; every other URL is reported with a status and is free. Apify key-value store record URLs (https://api.apify.com/v2/key-value-stores/<storeId>/records/<key>) work too, including records in your own private stores. To pass many URLs, link or upload a text file with one URL per line. Limits: 20,000 URLs per run; duplicate URLs are processed once; private or internal addresses, URLs with user:password@, and ports other than 80, 443, 8080 and 8443 are refused.

## `maxFileSizeMb` (type: `integer`):

Largest PDF to download, in megabytes. A bigger file gets status TOO_LARGE and is free: the size is checked from the Content-Length header before downloading and enforced again while downloading. The default of 50 MB is tested with the default 256 MB of memory. Larger files are allowed up to 200 MB, but disk space is twice the run memory, so at 256 MB they are processed one at a time; start the run with more memory for batches of large files.

## `maxPages` (type: `integer`):

Maximum number of pages extracted from one PDF (counted after the page range, if one is set). PDFs with more pages are handled according to "If a PDF has more pages". Default 500. A higher limit costs the same per PDF but produces larger output and takes longer; very long or dense PDFs may need a run with more memory.

## `pageLimitBehavior` (type: `string`):

"truncate" (default) extracts the first maxPages pages, sets truncated to true and counts as a success (charged). "skip" extracts nothing from longer PDFs and reports status TOO_MANY_PAGES (free).

## `pageRange` (type: `string`):

Optional. Extract only these pages from every PDF, for example "1-5,8,12-" (pages 1 to 5, page 8, and page 12 to the end). Pages are numbered from 1 by their position in the file. Leave empty to extract all pages. A PDF with none of these pages gets status NO_PAGES_IN_RANGE (free).

## `includePageTexts` (type: `boolean`):

Add a pages array to each item: \[{pageNumber, text, charCount, likelyScanned}], so text can be cited by page and scanned pages are visible. Turn off to roughly halve the item size when only the full text or the chunks are needed. No effect on price.

## `chunkSize` (type: `integer`):

Maximum characters per chunk for RAG and embeddings. 0 (default) turns chunking off. When set (100 to 20000; typical 1000 to 8000, about 250 to 2000 tokens), each item gets a chunks array \[{chunkIndex, text, charCount, pageStart, pageEnd}]. Chunks end at word boundaries and remember the pages they cover. No extra charge.

## `chunkOverlap` (type: `integer`):

Characters repeated from the end of one chunk at the start of the next, so sentences cut by a chunk boundary stay searchable. Used only when chunk size is above 0. Default 200; values above half the chunk size are reduced to half.

## `password` (type: `string`):

Optional password for encrypted PDFs. It is tried on every PDF in the run that needs one and is stored encrypted. Leave empty for ordinary PDFs. An encrypted PDF without the right password gets status ENCRYPTED (free).

## `maxConcurrency` (type: `integer`):

How many PDFs are downloaded and extracted at the same time. The default of 2 suits the default 256 MB of memory. The Actor lowers this number by itself when the run's memory cannot hold that many (about 64 MB per PDF on top of about 110 MB for the Actor), so to go faster raise the run memory too, for example 8 with 1024 MB. With 1 the dataset rows are in input order.

## `requestTimeoutSecs` (type: `integer`):

Time limit for downloading one PDF, including redirects and up to two retries of temporary errors. When it expires the PDF gets status DOWNLOAD_FAILED (free). Default 60; raise it for large files on slow hosts.

## `perDocumentTimeoutSecs` (type: `integer`):

Time limit for extracting the text of one PDF after it was downloaded. When it expires the extraction is stopped and the PDF gets status TIMEOUT (free). Default 120. CPU share follows run memory, so thousands of pages at 256 MB may need a higher limit or more memory.

## `proxyConfiguration` (type: `object`):

Optional proxy for the downloads. Default: no proxy (direct download), which is fastest and works for most public PDFs. Use Apify Proxy or your own proxy URLs only when a host refuses direct requests. The target URL is checked against the private-address rules either way.

## Actor input object example

```json
{
  "pdfUrls": [
    {
      "url": "https://www.govinfo.gov/content/pkg/BILLS-118hr82enr/pdf/BILLS-118hr82enr.pdf"
    }
  ],
  "maxFileSizeMb": 50,
  "maxPages": 500,
  "pageLimitBehavior": "truncate",
  "pageRange": "",
  "includePageTexts": true,
  "chunkSize": 0,
  "chunkOverlap": 200,
  "maxConcurrency": 2,
  "requestTimeoutSecs": 60,
  "perDocumentTimeoutSecs": 120,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

Status, counts and metadata per PDF.

## `items` (type: `string`):

Complete dataset items as JSON.

## `pages` (type: `string`):

The pages of every PDF as rows.

## `chunks` (type: `string`):

The chunks of every PDF as rows (when chunking is on).

## `runSummary` (type: `string`):

The OUTPUT record of the run.

# 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 = {
    "pdfUrls": [
        {
            "url": "https://www.govinfo.gov/content/pkg/BILLS-118hr82enr/pdf/BILLS-118hr82enr.pdf"
        }
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("ravensource/pdf-text-extractor").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 = {
    "pdfUrls": [{ "url": "https://www.govinfo.gov/content/pkg/BILLS-118hr82enr/pdf/BILLS-118hr82enr.pdf" }],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("ravensource/pdf-text-extractor").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 '{
  "pdfUrls": [
    {
      "url": "https://www.govinfo.gov/content/pkg/BILLS-118hr82enr/pdf/BILLS-118hr82enr.pdf"
    }
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call ravensource/pdf-text-extractor --silent --output-dataset

```

## MCP server setup

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

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/wpw8b3TmBelUB7A8Y/builds/flYcQqEwxQ8jNV8eR/openapi.json
