# OCR PDF to Markdown in English, German, French, Spanish

**Use case:** 

Runs OCR on the first three pages of a French EU directive PDF with English, German, French and Spanish language packs, and returns the text as Markdown with an OCR confidence score.

## Input

```json
{
  "fileUrls": [
    "https://eur-lex.europa.eu/legal-content/FR/TXT/PDF/?uri=CELEX:32023L2673"
  ],
  "keyValueStoreKeys": [
    "report-2025.pdf",
    "scan-001.png"
  ],
  "datasetUrlField": "url",
  "outputFormat": "markdown",
  "chunking": "none",
  "chunkSize": 512,
  "chunkOverlap": 64,
  "pageMarkers": false,
  "ocr": true,
  "forceOcr": true,
  "ocrLanguages": [
    "eng",
    "deu",
    "fra",
    "spa"
  ],
  "ocrDpi": 300,
  "pageRange": "1-3",
  "maxPagesPerDocument": 1000,
  "extractTables": true,
  "extractImages": false,
  "minImageSize": 64,
  "maxImagesPerDocument": 200,
  "removeHeadersFooters": true,
  "htmlMainContentOnly": true,
  "maxFileSizeMb": 100,
  "documentTimeoutSecs": 300,
  "downloadTimeoutSecs": 120,
  "maxConcurrency": 3
}
```

## Output

```json
{
  "status": {
    "label": "Status",
    "format": "string"
  },
  "filename": {
    "label": "File",
    "format": "string"
  },
  "file_type": {
    "label": "Type",
    "format": "string"
  },
  "pages": {
    "label": "Pages",
    "format": "integer"
  },
  "pages_processed": {
    "label": "Billed pages",
    "format": "integer"
  },
  "ocr_pages": {
    "label": "OCR pages",
    "format": "integer"
  },
  "word_count": {
    "label": "Words",
    "format": "integer"
  },
  "token_count": {
    "label": "Tokens",
    "format": "integer"
  },
  "tables_count": {
    "label": "Tables",
    "format": "integer"
  },
  "markdown_url": {
    "label": "Markdown file",
    "format": "string"
  },
  "processing_ms": {
    "label": "Time (ms)",
    "format": "integer"
  },
  "source_url": {
    "label": "Source",
    "format": "string"
  },
  "errors": {
    "label": "Errors",
    "format": "array"
  }
}
```

## How it works

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

The Document to Markdown for LLM & RAG (PDF, DOCX, PPTX, XLSX, OCR) Actor is ready to run with the inputs already set for "OCR PDF to Markdown in English, German, French, Spanish". [Sign up or log in](https://console.apify.com/create-task-from-example/ReEJAU3yHBM3lpwyh) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "OCR PDF to Markdown in English, German, French, Spanish" task

The Document to Markdown for LLM & RAG (PDF, DOCX, PPTX, XLSX, OCR) Actor will start running based on the input automatically. You can also change all the input fields, like file urls, key-value store keys, and more, to match your specific use case.

### 3. Receive the "OCR PDF to Markdown in English, German, French, Spanish" 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 status, file, type, 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 "OCR PDF to Markdown in English, German, French, Spanish" task via API](https://apify.com/tidewell/doc-to-markdown.md).

## FAQ

### How much does a conversion cost?

$0.002 per converted document plus $0.0003 per page with text. OCR pages cost $0.0027 more. Failed, empty or unsupported files are free.

### Do I need forceOcr for scanned PDFs?

No. Scanned pages are detected and OCRed automatically. forceOcr is used here only to show OCR on a digital PDF; leave it off for mixed files to save cost.

### Which OCR languages are available?

Tesseract language codes such as eng, deu, fra, spa, ita, nld and por. List several to read multilingual documents.

### Why only pages 1-3?

To keep the example cheap. Clear pageRange to convert the whole document.

### Can I convert my own files?

Yes. Paste direct file links, Google Drive, Dropbox or GitHub share links, or upload files in the input. You can also point it at a dataset of URLs from another actor.

## About this Actor

This example demonstrates how to use [Document to Markdown for LLM & RAG (PDF, DOCX, PPTX, XLSX, OCR)](https://apify.com/tidewell/doc-to-markdown.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/tidewell/doc-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/tidewell/doc-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`).
