# PDF to Images: pages to PNG, JPEG or WebP at any DPI (`examsens.ai/pdf-to-images`) Actor

Renders the pages of every PDF you link or store to PNG, JPEG or WebP at the DPI you choose, for all pages or the ranges you list. Handles password protected PDFs, grayscale, transparent backgrounds and a ZIP per PDF. Returns a download link for each page.

- **URL**: https://apify.com/examsens.ai/pdf-to-images.md
- **Developed by:** [Ed Rayyis](https://apify.com/examsens.ai) (community)
- **Categories:** Automation, Developer tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.50 / 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.

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: pages to PNG, JPEG or WebP at any DPI

Give it PDF files, by link or from one of your key value stores, and it renders the pages you pick to PNG, JPEG or WebP at the DPI you set. Every page image goes into the run's key value store, and the dataset gives you its download link with the page number, size and DPI.

### What it does

- Formats: PNG (lossless), JPEG or WebP, with a quality setting for JPEG and WebP
- DPI from 36 to 600: 72 for previews, 150 for documents, 300 for print and OCR. A US Letter page is 1275 by 1650 pixels at 150 DPI and 2550 by 3300 at 300 DPI
- Page ranges such as `1-3, 5, 8-`, where `8-` runs to the last page. Empty renders every page. Pages past the end of a PDF are skipped
- Form fields are drawn on the page
- Password protected PDFs: set the password and the pages render
- Grayscale: shades of gray
- Transparent background for PNG and WebP
- ZIP per PDF: one ZIP file with every rendered page, free
- Very large pages are rendered at a lower DPI so one image stays under 60 megapixels, and the item gives the DPI used

### Example

A 6 page tax form rendered at 150 DPI gave PNG pages of 1275 by 1650 pixels. Page 1 at 300 DPI in grayscale with a transparent background came out at 2550 by 3300 pixels and 753,406 bytes. Pages `1-2, 14-` of a 14 page paper at 100 DPI as JPEG gave pages 1, 2 and 14 at 850 by 1100 pixels, and a ZIP of the 3 pages.

### Input

- PDF URLs: direct links to PDF files
- Files in a key value store: to use PDFs from your computer, upload them to one of your key value stores and pick that store. Every record whose key ends in `.pdf` is processed
- Record keys: only process these records from that store
- Pages (default all)
- DPI (default 150)
- Image format: PNG (default), JPEG or WebP, and quality (default 85)
- Grayscale (default off)
- Transparent background (default off)
- Smaller PNG files (default off): slower compression, same pixels
- ZIP per PDF (default off)
- PDF password, tried on every PDF in the run
- Maximum pages per PDF (default 500)
- Maximum file size in MB (default 100)

### Output

Dataset: one item per page with `imageUrl` (download link), `imageKey`, `pageNumber`, `pageCount`, `format`, `dpi`, `imageWidth`, `imageHeight` and `imageBytes`. With ZIP per PDF, one more item per PDF with `zipUrl`, `zipKey`, `zipPages` and `zipBytes`. Files are named by the PDF's position in your list, its file name and the page number, such as `0002-fw9-page-0001.png`.

A PDF that cannot be read gets `ok: false` and an `error`, such as `HTTP 404`, "the link returns a web page, not a PDF file", "the file is not a PDF this actor can read", or "the PDF is password protected; set the password input". One bad PDF never stops the run.

### Pricing

Pay per event: one event per page image saved. ZIP files and failed PDFs are not charged. The run stops when it reaches the maximum charge you set.

### Scope and conduct

Only the files you supply are downloaded. The actor does not log in anywhere and uses no proxies. The password you give is used only to open your PDFs. Convert documents you have the right to use.

### Support

Questions and problems: the Issues tab on this page. Replies are written by an AI assistant on behalf of the developer and reviewed by the developer.

# Actor input Schema

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

Direct links to PDF files.

## `inputStore` (type: `string`):

To use PDFs from your computer, upload them to one of your key value stores, then pick that store here. Every record whose key ends in .pdf is processed, or only the keys you list below.

## `inputKeys` (type: `array`):

Only process these records from the store above, one key per line. Empty processes every record whose key ends in .pdf.

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

Which pages to render, such as 1-3, 5, 8- (8- runs to the last page). Empty renders every page. Pages past the end of a PDF are skipped.

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

Resolution: 72 for screen previews, 150 for documents, 300 for print and OCR. A US Letter page at 150 DPI is 1275 by 1650 pixels.

## `imageFormat` (type: `string`):

PNG is lossless. JPEG and WebP give smaller files.

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

1 to 100 for JPEG and WebP. PNG ignores it.

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

Render in shades of gray.

## `transparentBackground` (type: `boolean`):

Leave the page background transparent in PNG and WebP. JPEG always has a white background.

## `optimizePng` (type: `boolean`):

Spend more time compressing PNG files. The pixels stay the same.

## `zipPerPdf` (type: `boolean`):

Also save one ZIP file with every rendered page of each PDF. Free.

## `password` (type: `string`):

Password to open protected PDFs. The same password is tried on every PDF in the run.

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

Upper limit of pages rendered from one PDF.

## `maxFileSizeMb` (type: `integer`):

Larger PDFs are skipped with an error item and are not charged.

## Actor input object example

```json
{
  "pdfUrls": [
    {
      "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    }
  ],
  "dpi": 150,
  "imageFormat": "png",
  "quality": 85,
  "grayscale": false,
  "transparentBackground": false,
  "optimizePng": false,
  "zipPerPdf": false,
  "maxPagesPerPdf": 500,
  "maxFileSizeMb": 100
}
```

# Actor output Schema

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

No description

# 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": [
        {
            "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("examsens.ai/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 = { "pdfUrls": [{ "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" }] }

# Run the Actor and wait for it to finish
run = client.actor("examsens.ai/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 '{
  "pdfUrls": [
    {
      "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
    }
  ]
}' |
apify call examsens.ai/pdf-to-images --silent --output-dataset

```

## MCP server setup

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