# PDF to Image — Convert PDF Pages to PNG or JPEG (`ponderable_hydrometer/pdf-to-image`) Actor

Convert the pages of PDF files to PNG or JPEG images at the resolution you choose. Pass PDF links; get one image per page with its size. Useful for previews, thumbnails, OCR and vision models. No API key.

- **URL**: https://apify.com/ponderable_hydrometer/pdf-to-image.md
- **Developed by:** [Ponderable Hydrometer](https://apify.com/ponderable_hydrometer) (community)
- **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 results

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 Image — Convert PDF Pages to PNG or JPEG

**Every page of a PDF as an image.** Make previews and thumbnails, feed pages to OCR or a vision model, or archive documents as pictures. Rendering uses Poppler, the same engine many desktop PDF viewers use.

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `pdfUrls` | array | — | Direct links to PDFs. |
| `format` | string | `png` | `png` or `jpeg`. |
| `dpi` | integer | `150` | Resolution. |
| `maxPagesPerPdf` | integer | `50` | Page cap per file. |

### What you can do with it

- **Preview and thumbnails**: render the first pages of many PDFs at a low dpi.
- **Prepare pages for OCR or vision models**: one image per page at up to 400 dpi.
- **Archive documents as pictures** (PNG or JPEG).

### Input example

```json
{
  "pdfUrls": ["https://arxiv.org/pdf/1706.03762"],
  "format": "png",
  "dpi": 150,
  "maxPagesPerPdf": 3
}
```

`dpi` ranges from 36 to 400; 72 is screen quality, 150 is sharp for reading and 300 suits print.

### What you get

One row per page: `pdfUrl`, `page`, `totalPages`, `imageUrl` (the image in the run's key-value store), `format`, `dpi`, `width`, `height`, `bytes`.

### Output sample

```json
{
  "pdfUrl": "https://arxiv.org/pdf/1706.03762",
  "page": 1,
  "totalPages": 15,
  "imageUrl": "https://api.apify.com/v2/key-value-stores/abc/records/pdf-2-page-1.png",
  "format": "png",
  "dpi": 150,
  "width": 1275,
  "height": 1650,
  "bytes": 284311
}
```

### Use it from the API or an AI agent

```bash
curl -X POST "https://api.apify.com/v2/acts/ponderable_hydrometer~pdf-to-image/run-sync-get-dataset-items?token=<YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"pdfUrls": ["https://arxiv.org/pdf/1706.03762"], "maxPagesPerPdf": 3}'
```

Through the Apify MCP server: `https://mcp.apify.com?tools=ponderable_hydrometer/pdf-to-image`.

### Limits and good to know

- **First pages only.** `maxPagesPerPdf` (default 50) converts pages 1 to N; there is no page-range option.
- Password-protected PDFs are not supported; a file that cannot be read produces no rows. If every file fails, the run ends as FAILED.
- **Cost scales with pages:** one result is one page image, so a 50-page PDF at the default cap is 50 results, which is $0.10 at $2.00 per 1,000 results.
- Width and height are reported for PNG; for JPEG they are left empty.
- Each PDF must download within 120 seconds.
- High DPI on long documents makes large files; start with 150.
- Files are stored in the run's key-value store as `pdf-<file number>-page-<page>.png` or `.jpg`.

### FAQ

**Does it do OCR?** No. It produces images only.

**What renders the pages?** Poppler (`pdftoppm`).

### Pricing

Pay per result — **$2.00 per 1,000 results** (one page image = one result), plus Apify's standard per-run start event ($0.00005 per GB of memory, so a fraction of a cent per run). No subscription.

# Actor input Schema

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

Direct links to PDF files.

## `format` (type: `string`):

Output format.

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

72 = screen, 150 = sharp, 300 = print.

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

Only the first pages are converted.

## Actor input object example

```json
{
  "pdfUrls": [
    "https://raw.githubusercontent.com/mozilla/pdf.js/master/web/compressed.tracemonkey-pldi-09.pdf",
    "https://arxiv.org/pdf/1706.03762"
  ],
  "format": "png",
  "dpi": 150,
  "maxPagesPerPdf": 3
}
```

# Actor output Schema

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

All rows produced by this run, as JSON.

# 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": [
        "https://raw.githubusercontent.com/mozilla/pdf.js/master/web/compressed.tracemonkey-pldi-09.pdf",
        "https://arxiv.org/pdf/1706.03762"
    ],
    "maxPagesPerPdf": 3
};

// Run the Actor and wait for it to finish
const run = await client.actor("ponderable_hydrometer/pdf-to-image").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": [
        "https://raw.githubusercontent.com/mozilla/pdf.js/master/web/compressed.tracemonkey-pldi-09.pdf",
        "https://arxiv.org/pdf/1706.03762",
    ],
    "maxPagesPerPdf": 3,
}

# Run the Actor and wait for it to finish
run = client.actor("ponderable_hydrometer/pdf-to-image").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": [
    "https://raw.githubusercontent.com/mozilla/pdf.js/master/web/compressed.tracemonkey-pldi-09.pdf",
    "https://arxiv.org/pdf/1706.03762"
  ],
  "maxPagesPerPdf": 3
}' |
apify call ponderable_hydrometer/pdf-to-image --silent --output-dataset

```

## MCP server setup

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

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/nRX1m4yJZ56laf8w3/builds/vCmu2DYgV16nSfRtg/openapi.json
