# PDF to Text: PDF Text Extractor with OCR Fallback (`luxe_tasks/pdf-text-extractor`) Actor

PDF to text: reads each page's text layer and OCRs scanned pages locally. Uploads or file URLs, no API key, no proxy. Pay per page.

- **URL**: https://apify.com/luxe_tasks/pdf-text-extractor.md
- **Developed by:** [Luxe Tasks](https://apify.com/luxe_tasks) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 88.2% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 text-layer 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?

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: PDF Text Extractor with OCR Fallback

Developer: Luxe_tasks.

Turn PDF files into plain text. For every page, the Actor first reads the PDF's **embedded text layer** (PDF.js, inside the Actor). Only pages
without a usable text layer, such as scanned pages or pictures of text, are rendered and read with **local Tesseract OCR**. No API key, no
proxy and no third-party service: your files are processed inside the Actor.

- Born-digital PDFs (reports, invoices, papers exported from an editor): text comes straight from the text layer, fast and with the
  original characters.
- Scanned PDFs: each page is read with English OCR; output may differ from the printed text (spacing, special characters, small fonts).
- Mixed PDFs: each page is handled on its own; the per-page `source` field says `text_layer` or `ocr`.
- The Actor reads the text a PDF already contains, or recognises printed text on scanned pages, and returns it as plain text for your own use; it does not give you any right to reuse the document.
- The Actor does not open, decrypt or work around passwords, encryption or copy restrictions in any PDF, and it has no password field.
- Three ways in: upload a PDF with the **Upload a PDF** button, list records of the run's key-value store (API), or (for documents you own or are licensed to process) give direct file URLs.

### Try it

The input is prefilled with **Include sample document** switched on, matching Apify Store's daily test, which runs the Actor with the input schema prefill. An empty API input {} runs the same bundled sample: a two-page PDF written for this Actor, whose page 1 is read from its text layer and page 2 with OCR; sample rows add no page charge, but the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

If you also give files, an upload or URLs, the sample adds one extra row. The sample file is checked against its pinned SHA-256 before it is read; if the check fails, the run fails.

### Do not submit sensitive data

Do not submit protected health information (PHI) as defined under HIPAA, or consumer health data. This Actor is not HIPAA-compliant and the developer will not sign a Business Associate Agreement. Do not submit government ID documents, payment-card or bank-account numbers, or other sensitive personal data unless you have a lawful basis to process it and have assessed that this Actor is appropriate. You are the controller; the developer acts only as your processor.

### Your responsibility

Only process documents you own or are licensed to process. Under Apify's Standard Actor Contract you are responsible for the files and URLs you provide, for having the right to provide them, and for how you use the extracted text, including compliance with copyright and data-protection law.

If your documents contain personal data, you are the controller and the developer is the processor under the Standard Actor Contract; process only data you have a lawful basis for, and don't submit health records or other special-category data.

### Input

- **uploadedFile** (optional, **Upload a PDF** button): one PDF from your computer. Apify stores it in your key-value store, and the Actor reads
  it through the Apify platform (never by downloading a link). Apify storage links typed into `files` are not accepted as file URLs.
- **includeSampleDocument** (default off, prefilled on): add the bundled 2-page sample as one extra row.
- **files** (optional; empty or missing runs the bundled sample unless Include sample document is switched off): a list of PDF files, each one of
  - `{"key": "report"}`: a record in **this run's default key-value store** (for API callers that write the record before the Actor reads it);
  - `{"fileUrl": "https://example.com/doc.pdf"}`: **file URL mode**, only for documents **you own or are licensed to process**; one file per
    URL, no crawling or link following. Requires **documentRightsAttestation = true** ("I own or am licensed to process every document at these
    URLs, and fetching them does not get around any access control."); without it the run stops before making any request.
  - URL limits: at most **50 file URLs per registered domain** and **200 per run**; URLs over the cap are skipped (`skipped_url_cap`) and
    not fetched, with no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies. URLs with a user name or password (`user:pass@host`) are refused.
    Presigned URLs are accepted (Apify storage links are not; use the upload button); their query strings are **never logged** and appear in results only as `?[redacted]`.

If the input is invalid, for example a file URL without the rights confirmation, the run stops before reading any file and adds no page charge; the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

With Include sample document switched off and no files, upload or URLs, the run fails with: "Invalid input: add at least one PDF file or URL, or switch on Include sample document; nothing was processed, but the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies."

- Accepted: PDF only (decided by the file's bytes, not its name), up to **20 MB** and **1,000 pages** per file; at most **50 pages per
  file** are read with OCR (later scanned pages get `OCR_PAGE_LIMIT`). A file has up to **480 s**. Measured OCR on our test files was about 10.7 to 14.7 seconds per scanned page (may vary), so about 32 to 44 scanned pages fit in that 480 s when the file is processed alone at 2 GB; the per-file cap remains 50 OCR pages. When several scanned files are processed at once they share one OCR reader, so each may get fewer scanned pages within its 480 s; pages not reached get `file_timeout` or `ocr_timeout` with no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies. Encrypted or password-protected PDFs, files that aren't PDFs, and files over the size or page limits get a status row and no text; those rows are not billed events, but the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies. No passwords are taken: an input with a `password` or `pdfPassword` key fails with "Invalid input: this Actor takes no PDF passwords and refuses encrypted PDFs.", and every encrypted PDF (owner-password-only included) gets the status `ENCRYPTED_REFUSED`.
- Per run: by default at most **2,000 text-layer pages** (`maxTextPagesPerRun`, up to 20,000) and **100 OCR pages** (`maxOcrPagesPerRun`,
  up to 500), and 1 GB of files in total (`RUN_BYTE_LIMIT`). The default run timeout is 900 s; the maximum caps need a 3,600 s timeout.
- **ocrFallback** (default on): OCR pages that have no usable text layer. Off: only text layers are read; other pages are reported as
  `no_text_layer` / `text_layer_unusable` with no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.
- OCR settings (used only for pages without a text layer): **language** `eng`; **layout** `auto` / `single-column` / `sparse`;
  **renderDpi** 100-300 (default 200); **pageTimeoutSecs** (default 60).
- **maxPagesPerFile** (default 1,000), **includeTextInDataset** (default true), **maxConcurrency** (default 3; reduced to what fits in memory: 1 file at 1 GB, 2 at 2 GB, 4 at 4 GB; OCR reads one page at a time).

### Output

- One dataset record per file: `status`, `pageCount`, `pagesWithText`, `pagesFromTextLayer`, `pagesFromOcr`, `pagesNotCharged`, `pages`
  (per page: `source`, `status`, and for OCR pages word count and mean confidence), `fileSha256`, `text` (first 100,000 characters),
  `textChars`, `link`. When a status is shown in capitals, the original lower-case code is kept in `kitStatus`.
- The **full text** of each file is saved as a `.txt` record in the run's default key-value store (pages separated by a form feed `\f`).
- `RUN_SUMMARY` in the key-value store has counts and the page events charged; the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB is not counted there.

#### Status codes

Only `success` rows carry page events. Every other status below adds no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

| Status | Meaning |
|---|---|
| `success` | text was read; billed per page, plus the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB per run (see Pricing) |
| `sample` | the bundled sample was read; no page events, but the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies |
| `no_text_found` | no page had readable text |
| `FILE_TOO_LARGE` | the file is over 20 MB |
| `too_many_pages` | the file has more pages than `maxPagesPerFile` |
| `FILE_BOMB` | the file's structure or compressed streams expand beyond the safety limits |
| `NOT_A_PDF` | the bytes are not a PDF (or the URL returned a web page, or the list entry is neither a record key nor a file URL) |
| `ENCRYPTED_REFUSED` | the PDF is encrypted (any kind); it is not opened |
| `extraction_not_permitted` | the PDF could not be read for text under its own settings |
| `corrupt_file` | the PDF could not be parsed |
| `file_not_found` | the record or uploaded file (or the storage it was uploaded to) is missing or empty |
| `upload_access_denied` | the Actor was not allowed to read the uploaded file |
| `invalid_input` | this list entry is not valid input |
| `budget_reached` | your maximum total charge cannot cover the file; no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies |
| `render_timeout` / `render_memory_limit` | the PDF renderer ran out of time or memory |
| `file_timeout` / `ocr_timeout` | the file (or its OCR reading) reached its time limit; later pages were not read and add no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies |
| `run_time_limit` | the run was close to its timeout (or 60 minutes), so the file was not started |
| `uncharged_work_limit` | too much work without readable text in this run; the file was not started |
| `run_text_page_limit` / `run_ocr_page_limit` | the per-run page cap was reached |
| `RUN_BYTE_LIMIT` | the run already read 1 GB of files |
| `sample_check_failed` | the bundled sample did not match its pinned SHA-256 |
| `ocr_failed` | the OCR engine failed on the file |
| `internal_error` | an unexpected error; please report it |
| `charge_failed` / `save_failed` / `state_save_failed` / `delivered_record_failed` | a platform write or charge step failed; the file adds no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies |
| `resumed_skip` | after a platform restart, the file was already done |
| `url_mode_disabled` | file URLs are switched off in this build |
| `skipped_url_cap` | over 50 URLs for one site or 200 per run |
| `INVALID_URL` | not an http(s) URL, a URL with a user name or password, or a non-standard port |
| `PRIVATE_ADDRESS_REFUSED` (`kitStatus: ssrf_blocked`) | the URL, one of its redirects or its DNS result points at a private, loopback, link-local or cloud-metadata address, or at an Apify platform host, so it was refused without fetching the file |
| `OPTED_OUT` | the site's owner asked not to be fetched |
| `ROBOTS_DISALLOWED` / `ROBOTS_UNREACHABLE` | robots.txt disallows the file, or could not be read (server or network error) |
| `ACCESS_DENIED` | the site answered 401, 403, 407, 430 or 451 |
| `RATE_LIMITED` | the site answered 429 or asked to retry later |
| `CHALLENGE_DETECTED` | the site showed a CAPTCHA or bot check |
| `LOGIN_REQUIRED` | the site asked for a login |
| `SITE_UNREACHABLE` | DNS, TLS, a timeout or a 5xx error |
| `TOO_MANY_REDIRECTS` | more than 5 redirects |
| `skipped_blocked` / `domain_stopped` | the site was stopped earlier in the run; not requested |
| `redirect_out_of_scope` | a redirect left the allowed scheme or port |
| `download_failed` | another download error (for example 404) |

Page statuses other than `ok` (`blank`, `low_confidence`, `no_text_layer`, `text_layer_unusable`, `ocr_timeout`, `render_failed`,
`page_too_large`, `page_too_complex`, `render_timeout`, `file_timeout`, `not_rendered`, `uncharged_work_limit`, `OCR_PAGE_LIMIT`,
`run_text_page_limit`, `run_ocr_page_limit`) add no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

### Pricing

You pay $1.00 per 1,000 pages read from a PDF's own text layer and $6.00 per 1,000 scanned pages read with OCR, plus a start fee for each run of $0.005 per GB of memory, $0.01 at the default 2 GB (minimum one event, $0.005). Blank, failed and refused pages add no page charge, but the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

- Events: `text-page` ($0.001) for each page read from the text layer; `ocr-page` ($0.006) for each scanned page read with OCR; Apify's `apify-actor-start` ($0.005 per GB of memory, $0.01 at the default 2 GB; $0.005 at 1 GB, $0.02 at 4 GB), which is the start fee.
- Each file is billed with one event type: a file with at least one page read with OCR pays $0.006 for each OCR page and no page charge for its text-layer pages, a file with no OCR pages pays $0.001 for each text-layer page, and every run also pays the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB.
- Page charges happen only after a file's text and record are saved, once per file, on top of the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB. Before any page is read, the Actor checks that your remaining maximum charge covers all its pages; if not, the file is refused as `budget_reached` with no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

### Limits

- A PDF page must render within 15 s and decode to at most 1,000,000 drawing operations; a file must finish within 480 s. PDFs whose
  compressed streams expand beyond the Actor's limits are refused before reading (`FILE_BOMB`). The PDF reader runs in a separate process
  that is stopped above its memory limit (`render_memory_limit`).
- A run stops starting new files about 4 minutes before its run timeout (default 900 s; the maximum caps need 3,600 s) or after 60 minutes, whichever comes first, and files it did not start get a `run_time_limit` row with no page charge, while the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.
- A file that starts late in the run gets less time (it must end 60 s before the run timeout), so a long scanned file near the end can end with `file_timeout` pages.
- A run also stops taking new files once work without text reaches 25 files, 500 pages or 10 minutes.
- OCR reads one page at a time for the whole run (one OCR slot per run). About 32 to 44 scanned pages per file fit in the 480 s file limit when that file is processed alone (measured about 10.7 to 14.7 seconds per scanned page on our test files; may vary); files read at the same time share the slot and get less of it.
- At about 10.7 to 14.7 seconds per scanned page (measured on our test files; may vary), the default run cap of 100 OCR pages (about 1,070 to 1,470 s) cannot fully finish inside the default 900 s run window, after the time reserved before the run timeout. Pages that don't fit get unbilled timeout rows (`file_timeout`, or `run_time_limit` for files not started) with no page charge, while the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

### Retention and logging

Results are written only to your run's default Apify storage; the developer does not copy, view, retain or share them, and logs record only the URL with its query string redacted, the status, page counts and timings, never document text. Your run's storage follows your Apify plan's data retention settings, and unnamed storages are deleted automatically when that period ends, so export anything you need to keep.

- A file you upload stays in your own Apify key-value store where Apify put it; the Actor reads it and does not copy, change or delete it. No data is used for training.

### URL mode safety

If a site's robots.txt disallows the file or can't be read because of a server or network error, the site denies access, asks for a login or shows a challenge, the Actor makes no further requests to that site and writes one status row per URL with the URL, a status and a reason, and no document content; status rows are not billed events, but the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

A file URL on an opted-out site, on a non-standard port or on an Apify platform host stops the whole run before any request is made, with no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies; remove that URL and run again.

For URLs, the Actor fetches only the single file at each URL, follows at most 5 redirects, sends no cookies or credentials, identifies itself with an honest user agent and honours robots.txt.

- robots.txt is honoured in file URL mode; uploads and the bundled sample make no requests to websites (an upload is read from your Apify storage through the Apify API).
- A robots.txt that returns 4xx (except 429) means no restrictions; a 429 is treated as a rate limit and stops the domain; 5xx or an unreachable robots.txt means nothing is fetched.
- Each download has a 15 s idle limit (connection and first byte) and a 60 s total limit across all redirects (`SITE_UNREACHABLE`).
- At most ~1 request per second per registered domain; fixed honest User-Agent
  `PdfTextExtractorActor/0.1.3 (+https://apify.com/luxe_tasks/pdf-text-extractor; honours robots.txt)`; no proxies, logins, cookies or tokens.
- A 403, 429 or CAPTCHA/challenge page stops the whole registered domain for the rest of the run; later files there are skipped with no page
  charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.
- Private, loopback, link-local and cloud-metadata addresses are refused, re-checked after DNS and on every redirect. A URL that returns a
  web page instead of a file is refused (no crawling).

### Acceptable use

> By running this Actor you confirm that:
>
> 1. You submit only files **you own or are licensed to process**, and you will use the output lawfully.
> 2. You do not submit protected health information or consumer health data. You submit other sensitive data covered by the notice above only with a lawful basis and after assessing the Actor as appropriate.
> 3. You do not use file URL mode to get around logins, paywalls, CAPTCHAs, rate limits or other access controls, or to crawl sites.
> 4. You comply with applicable law, including copyright and data-protection law (GDPR, CCPA and similar). You are the controller of any personal data in your files and results.
> 5. You do not use the Actor to identify, profile or track individuals. The Actor does not detect, extract or match faces and is not designed to.

### Privacy

> Results are written only to your run's default Apify storage. The developer does not copy, view or retain them. If your results contain
> personal data, you are the controller and the developer acts only as your processor under Apify's Standard Actor Contract. Apify's retention settings apply.

### Third-party software

PDF.js, Tesseract OCR and its tessdata English model (Apache-2.0), @napi-rs/canvas (MIT); details and licence texts in `NOTICE` and `licenses/`.

### Runtime

Node 24, Dockerfile `apify/actor-node:24` + Alpine `tesseract-ocr` 5.5.2. Memory: default **2048 MB**, minimum 1024 MB, maximum 4096 MB (text-only runs work at 1 GB). Files are processed 2 at a time at 2 GB (1 at 1 GB, 4 at 4 GB), and OCR reads one page at a time.

### Reporting

To report a problem or ask for your site to be added to the Actor's opt-out list, open an issue on the Actor's Issues tab; to report content on the Apify platform, use the notice process in section 13.2 of Apify's General Terms.

# Changelog

This Actor's version history is a separate document: https://apify.com/luxe_tasks/pdf-text-extractor/changelog.md

# Actor input Schema

## `files` (type: `array`):

PDF files (max 20 MB and 1,000 pages each; at most 50 pages per file are read with OCR). Optional: leave empty and switch on Include sample document to try the Actor. Uploads: \[{"key": "report"}] for a record in this run's default key-value store. File URLs: \[{"fileUrl": "https://example.com/doc.pdf"}] - only documents you own or are licensed to process, one file per URL, no crawling; needs the attestation below. At most 50 file URLs per registered domain and 200 per run (more are skipped and not fetched; the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies). URLs with a user name or password (user:pass@host) are refused; presigned URLs (not Apify storage links: use the upload field) are accepted and their query strings are never logged.

## `ocrFallback` (type: `boolean`):

On: pages with no usable text layer (scans, images) are read with local OCR. Off: only the embedded text layer is read; other pages are reported as no_text_layer, with no page charge (the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies).

## `language` (type: `string`):

OCR language model for pages without a text layer (Tesseract tessdata, English). English only in this version; text layers in any language are read as-is.

## `layout` (type: `string`):

auto = automatic page segmentation; single-column = one block of text; sparse = scattered text (forms, labels).

## `renderDpi` (type: `integer`):

PDF pages are rendered at this resolution before OCR (capped at 25 megapixels per page).

## `pageTimeoutSecs` (type: `integer`):

A page that takes longer is reported as ocr_timeout, with no page charge (the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies).

## `maxPagesPerFile` (type: `integer`):

PDFs with more pages are refused (too_many_pages), with no page charge (the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies). At most 50 pages per PDF are read with OCR.

## `maxTextPagesPerRun` (type: `integer`):

Pages read from text layers after this many get the status run_text_page_limit, with no page charge (the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies).

## `maxOcrPagesPerRun` (type: `integer`):

Scanned pages after this many get the status run_ocr_page_limit, with no page charge (the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies). The maximum (500) needs a 3,600 s run timeout.

## `includeTextInDataset` (type: `boolean`):

Also copy the text (first 100,000 characters) into each dataset record. The full text is always saved as a .txt file in the run's key-value store.

## `uploadedFile` (type: `string`):

Upload one PDF from your computer (stored in your Apify key-value store and read by the Actor through the Apify platform, never downloaded from a link). Same limits and statuses as other files; refused files get a status row with no page charge, and the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

## `includeSampleDocument` (type: `boolean`):

Adds one extra row: a short 2-page sample PDF that ships with the Actor (page 1 text layer, page 2 scanned). Sample rows are not billed events, but the start fee of $0.005 per GB of memory, $0.01 at the default 2 GB, still applies.

## `documentRightsAttestation` (type: `boolean`):

Required only when you give file URLs. Leave unticked for uploads.

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

Items processed in parallel (each site still gets at most 1 request per second).

## Actor input object example

```json
{
  "ocrFallback": true,
  "language": "eng",
  "layout": "auto",
  "renderDpi": 200,
  "pageTimeoutSecs": 60,
  "maxPagesPerFile": 1000,
  "maxTextPagesPerRun": 2000,
  "maxOcrPagesPerRun": 100,
  "includeTextInDataset": true,
  "uploadedFile": "",
  "includeSampleDocument": true,
  "documentRightsAttestation": false,
  "maxConcurrency": 3
}
```

# Actor output Schema

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

Default dataset items for this run (one row per PDF or sample).

# 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 = {
    "includeSampleDocument": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("luxe_tasks/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 = { "includeSampleDocument": True }

# Run the Actor and wait for it to finish
run = client.actor("luxe_tasks/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 '{
  "includeSampleDocument": true
}' |
apify call luxe_tasks/pdf-text-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,luxe_tasks/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/ZJX80VJcm5azBZzVU/builds/mUdn5NkuBbSaQEa0x/openapi.json
