# PDF to Images: Render Pages as PNG or JPG for AI Vision (`data-done-right/pdf-to-images`) Actor

PDF to Images: convert PDF pages to PNG, JPG or WebP from PDF URLs, sized for AI vision, OCR or previews. Pick pages, DPI and max side; one signed download link per page. Direct PDF links only: no password-protected files, no OCR, no text extraction.

- **URL**: https://apify.com/data-done-right/pdf-to-images.md
- **Developed by:** [Data Done Right](https://apify.com/data-done-right) (community)
- **Categories:** Developer tools, Automation, AI
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.20 / 1,000 page rendereds

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 Images: Render Pages as PNG or JPG for AI Vision

Use this **PDF to images converter** to **render PDF pages as PNG, JPG or WebP images** from a list of PDF URLs, sized for AI vision models, OCR or previews. Paste direct PDF links, pick the pages, the DPI and an optional maximum image size, and get one image file per page with a signed download link.

**What it does NOT do (read this first)**

- It renders pages to pictures. It does **not extract text**, does **no OCR** and does not read tables (use "Extract Text from PDF: OCR, PDF to Text & Markdown" for that).
- It takes **direct links to PDF files**, not web pages. A page URL is reported as failed.
- **Password-protected PDFs are not opened.** The row says so and is not charged.
- It honours the host's **robots.txt** and does not log in, use proxies or work around blocks. A 401, 403 or 429 is reported as failed; a URL that robots.txt disallows is skipped.
- Output is one image per page, on a white background. No merging pages into one tall image, no cropping, no watermark removal. Form fields and annotations are drawn the way PDFium draws them, and fonts that a PDF does not embed are replaced by what the renderer has, so rare fonts can look different from Acrobat.
- PDFs above your size limit (50 MB by default, 200 MB at most) are skipped. A single page above 50 megapixels is rendered at a lower resolution and the row says so.

### What you get

- One dataset row per rendered page: signed download link, page number, total pages, PDF title, width, height, DPI used, file size, `status` and a plain-language `note`.
- The images in the run's key-value store (kept as long as the run's storage is kept).
- A `SUMMARY` record with totals.

### What can this PDF page renderer do

- **PNG, JPEG or WebP** output (PNG keeps small text sharpest).
- **Choose pages**: `1`, `1-3,5` or `2-last`. Empty means all pages, up to your page limits.
- **Set the resolution** with `dpi` (20-400, default 150) or **cap the longest side** with `maxLongSidePx` (for example 1568 for vision models). The cap wins when a page would be larger.
- **Grayscale** option for smaller files of text documents.
- **Hard cost caps**: `maxPagesPerPdf` (default 50) and `maxPages` per run (default 200).
- **Safe with bad input**: one broken PDF never stops the run. Private, loopback and cloud-metadata addresses are refused.

### How to convert a PDF to PNG images

1. Paste the PDF links in **PDF URLs**, one per line.
2. Leave **Image format** on `png` and **Resolution** on 150 DPI.
3. Run it. Open the dataset or download JSON or CSV. Each `url` is a signed link that works without an API token.

### How to convert PDF pages to images for AI vision (Claude, GPT, Gemini)

Set `maxLongSidePx` to the largest side your model takes without resizing (for example 1568) and keep `dpi` at 150. Each page then arrives at a size the model reads well. Pass `pages` such as `1-5` to send only the part you need and keep the cost down. Feed the `url` values to your model, or download them in your pipeline.

### How to make a PDF thumbnail (first page as JPG)

Set `pages` to `1`, `outputFormat` to `jpeg`, `dpi` to 72 and `quality` to 80. You pay for one page per PDF.

### How to prepare PDF pages for OCR

Use `png`, 200-300 DPI and optionally `grayscale`. This Actor only produces the images; send them to an OCR tool of your choice.

### Input example

```json
{
  "urls": ["https://pdfobject.com/pdf/sample.pdf"],
  "pages": "1",
  "outputFormat": "png",
  "dpi": 150
}
```

### Input

| Field | Default | What it does |
|---|---|---|
| `urls` (required) | one sample PDF | Direct PDF links, one per line |
| `pages` | all | Pages to render, counted from 1: `1-3,5,last` |
| `outputFormat` | `png` | `png`, `jpeg` or `webp` |
| `dpi` | 150 | Resolution, 20-400 |
| `maxLongSidePx` | 0 (off) | Cap on the longest image side in pixels |
| `quality` | 85 | 1-100 for JPEG and WebP |
| `grayscale` | off | Render in grayscale |
| `maxPagesPerPdf` | 50 | Most pages from one PDF (up to 1,000) |
| `maxPages` | 200 | Most pages per run (up to 5,000) |
| `maxSourceSizeMb` | 50 | Skip larger PDFs (up to 200) |
| `concurrency` | 2 | PDFs downloaded in parallel (1-8) |

### Output

One row per page. This row comes from a real local run of the example above (the link shown is the form it takes on the Apify platform, where it also carries a signature):

```json
{
  "index": 1,
  "sourceUrl": "https://pdfobject.com/pdf/sample.pdf",
  "pdfTitle": "sample",
  "pdfPages": 1,
  "page": 1,
  "fileName": "sample-p1.png",
  "url": "https://api.apify.com/v2/key-value-stores/<storeId>/records/sample-1-p0001-d14159f524.png?signature=...",
  "format": "png",
  "width": 1275,
  "height": 1651,
  "dpi": 150.0,
  "bytes": 387918,
  "status": "rendered",
  "error": null,
  "note": null
}
```

- `status`: `rendered` (delivered, charged), `skipped` (duplicate URL, page limit, robots.txt, spending limit, address not allowed; not charged) or `failed` (download error, not a PDF, damaged, password-protected; not charged).
- A PDF that fails as a whole gives one row with `page: null` and the reason in `error`. If page limits cut off pages, one extra `skipped` row says how many.

### How much does it cost to convert PDF to images

Pay per event: **$0.003 per page rendered** (event `page-rendered`, $3.00 per 1,000 pages), plus the normal Apify platform usage of the run, which is small. Skipped and failed rows are free, and there is no start fee.

- 1,000 pages: $3.00
- 10,000 pages: $30.00
- 100,000 pages: $300.00 (run it in batches of up to 5,000 pages per run)

Set a maximum spending limit on the run: it stops cleanly when reached and the rest is reported as skipped.

### Use cases

- Send PDF pages to a vision model that reads images but not PDFs.
- Make first-page thumbnails for a document library or search results.
- Prepare scanned pages for an OCR engine.
- Show document previews in an app or an e-mail.
- Add a PDF step to a pipeline: an Actor or an AI agent passes PDF URLs and reads the links from the dataset.

### FAQ

**Does it extract the text?**
No. It only draws pages as pictures. Use "Extract Text from PDF: OCR, PDF to Text & Markdown" for text.

**What is a good DPI?**
150 for AI vision and previews, 200-300 for OCR, 72 for small thumbnails. A US Letter page is 1275 x 1650 pixels at 150 DPI.

**Which renderer is used?**
PDFium (the engine of Chrome) through the pypdfium2 library, under BSD-3 and Apache-2.0 licences.

**Will it open a password-protected PDF?**
No. It reports the file as failed with that reason and does not charge.

**What happens to a URL that robots.txt disallows?**
It is skipped with the reason and not charged. If a host's robots.txt cannot be read because of a server error, its PDFs are skipped too rather than guessed.

**Can I render a 500-page PDF?**
Yes, in parts: `maxPagesPerPdf` allows up to 1,000 pages per PDF and `maxPages` up to 5,000 per run. The defaults (50 and 200) are low on purpose so that a surprise PDF cannot run up a large bill.

### Use with the Apify API, MCP, n8n and Make

Python:

```python
from apify_client import ApifyClient

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("<username>/pdf-to-images").call(run_input={
    "urls": ["https://example.com/report.pdf"],
    "pages": "1-3",
    "maxLongSidePx": 1568,
})
for row in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(row["status"], row["page"], row["url"])
```

JavaScript:

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<APIFY_TOKEN>' });
const run = await client.actor('<username>/pdf-to-images').call({
  urls: ['https://example.com/report.pdf'],
  pages: '1-3',
  maxLongSidePx: 1568,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.map((r) => [r.status, r.page, r.url]));
```

The same input works from the Apify MCP server (an AI agent calls the Actor with a list of PDF URLs), from n8n and from Make through their Apify modules.

### Related tools

- **Extract Text from PDF: OCR, PDF to Text & Markdown** : get the text of a PDF instead of pictures.
- **PDF Compressor: Reduce PDF File Size in Bulk** : shrink a PDF before you share it.
- **PDF Merger & Splitter: Merge, Split, Extract Pages** : cut a PDF down to the pages you need first.
- **Batch Image Converter & Resizer: WebP, AVIF, PNG & JPEG** : convert or resize the page images afterwards.

# Actor input Schema

## `urls` (type: `array`):

Direct links to PDF files, one per line. Example: https://example.com/report.pdf. Web pages are not converted, password-protected PDFs are reported as failed. Use only PDFs you have the right to process.

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

Which pages to render, counted from 1. Example: 1-3,5,last. Empty means every page, up to Max pages per PDF.

## `outputFormat` (type: `string`):

Format of every page image. Example: png. PNG keeps small text sharp; JPEG and WebP are smaller. Pages are rendered on a white background.

## `dpi` (type: `integer`):

Rendering resolution in dots per inch; a US Letter page is 1275 x 1650 px at 150. 100-150 suits AI vision and previews, 200-300 suits OCR. Pages above 50 megapixels are rendered smaller. Example: 150.

## `maxLongSidePx` (type: `integer`):

Optional cap on the longest side of every page image, in pixels. 0 means no cap. Use it to stay under a vision model's image limit. When set, a page that would be larger is rendered smaller. Example: 1568.

## `quality` (type: `integer`):

Lossy quality for JPEG and WebP; ignored for PNG. Example: 85.

## `grayscale` (type: `boolean`):

Render pages in grayscale. Smaller files for text documents.

## `maxPagesPerPdf` (type: `integer`):

Most pages rendered from one PDF. Further requested pages are skipped and not charged. Example: 50.

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

Most pages rendered in the whole run, across all PDFs. Caps your cost. Example: 200.

## `maxSourceSizeMb` (type: `integer`):

PDFs larger than this are skipped before they are fully downloaded. Example: 50.

## `concurrency` (type: `integer`):

How many PDFs are downloaded at the same time. Rendering itself runs one page at a time. Default 2.

## Actor input object example

```json
{
  "urls": [
    "https://pdfobject.com/pdf/sample.pdf"
  ],
  "pages": "",
  "outputFormat": "png",
  "dpi": 150,
  "maxLongSidePx": 0,
  "quality": 85,
  "grayscale": false,
  "maxPagesPerPdf": 50,
  "maxPages": 200,
  "maxSourceSizeMb": 50,
  "concurrency": 2
}
```

# Actor output Schema

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

All result items of this run (the default dataset), as JSON, CSV, Excel and more.

## `records` (type: `string`):

Key-value store records: the run summary, notes on any problems, and any files.

# 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 = {
    "urls": [
        "https://pdfobject.com/pdf/sample.pdf"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("data-done-right/pdf-to-images").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 = { "urls": ["https://pdfobject.com/pdf/sample.pdf"] }

# Run the Actor and wait for it to finish
run = client.actor("data-done-right/pdf-to-images").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 '{
  "urls": [
    "https://pdfobject.com/pdf/sample.pdf"
  ]
}' |
apify call data-done-right/pdf-to-images --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,data-done-right/pdf-to-images"
        }
    }
}
```

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/X91RcQQSVjwcpm25I/builds/rCMChcANdmpdSRFqY/openapi.json
