# Extract PDF text and audit pages needing OCR

**Use case:** 

Reads public PDFs from direct URLs and audits each document's text layer, returning pdfType (TextBased, Scanned, Mixed or ImageBased), pagesNeedingOcr, page-numbered Markdown and plain text capped at 100,000 characters. Scanned documents with no text layer return status scan and are not charged, helping you route only scanned files to OCR.

## Input

```json
{
  "pdfUrls": [
    "https://pdfobject.com/pdf/sample.pdf",
    "https://www.orimi.com/pdf-test.pdf"
  ],
  "maxItems": 20,
  "maxPages": 100,
  "maxMbPerFile": 40,
  "maxChars": 100000,
  "respectRobotsTxt": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

## Output

```json
{
  "url": {
    "label": "PDF",
    "format": "string"
  },
  "title": {
    "label": "Title",
    "format": "string"
  },
  "status": {
    "label": "Status",
    "format": "string"
  },
  "pdfType": {
    "label": "Pdf type",
    "format": "string"
  },
  "pageCount": {
    "label": "Pages",
    "format": "integer"
  },
  "pagesReturned": {
    "label": "Pages read",
    "format": "integer"
  },
  "charCount": {
    "label": "Characters",
    "format": "integer"
  },
  "truncated": {
    "label": "Truncated",
    "format": "boolean"
  },
  "truncatedBy": {
    "label": "Cut by",
    "format": "string"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The PDF to Markdown Extractor: Page Numbers & Tables Actor is ready to run with the inputs already set for "Extract PDF text and audit pages needing OCR". [Sign up or log in](https://console.apify.com/create-task-from-example/gtq1dWC26oTKewhBa) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Extract PDF text and audit pages needing OCR" task

The PDF to Markdown Extractor: Page Numbers & Tables Actor will start running based on the input automatically. You can also change all the input fields, like PDF URLs, maximum pdfs, and more, to match your specific use case.

### 3. Receive the "Extract PDF text and audit pages needing OCR" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as PDF, title, status, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Extract PDF text and audit pages needing OCR" task via API](https://apify.com/kizukidata/pdf-to-markdown.md).

## FAQ

### What does the PDF text extraction and OCR scan audit task return?

The PDF text extraction and OCR scan audit task returns one row per PDF with status, pdfType, pageCount, pagesReturned, pagesNeedingOcr, markdown, text, charCount, byteCount and truncatedBy.

### How are scanned PDFs and image-only pages handled?

In the PDF text extraction and OCR scan audit task, a PDF with no text layer returns status scan and lists its 1-indexed pages in pagesNeedingOcr without being charged; no OCR is run.

### What happens to files larger than 40 MB?

In the PDF text extraction and OCR scan audit task, Maximum file size is set to 40 MB for default 1 GB memory runs; oversized files are skipped, listed in OUTPUT skippedInputs and not charged.

### Does the task require a login or read robots.txt?

The PDF text extraction and OCR scan audit task needs no login and has Respect robots.txt enabled, so disallowed paths are skipped free and listed in OUTPUT.

## About this Actor

This example demonstrates how to use [PDF to Markdown Extractor: Page Numbers & Tables](https://apify.com/kizukidata/pdf-to-markdown.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/kizukidata/pdf-to-markdown.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

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 full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/kizukidata/pdf-to-markdown.md

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`).
