# PDF to Image & Image to PDF: PNG, JPG, WebP, Bulk (`brasspage/pdf-to-image`) Actor

Convert PDF to image: every page, or a page range, to PNG, JPG or WebP at the DPI you choose. Reverse mode turns many images into one PDF. Bulk URLs or an upload. Free open source engines (PDFium, img2pdf). $0.001 per page.

- **URL**: https://apify.com/brasspage/pdf-to-image.md
- **Developed by:** [Brasspage](https://apify.com/brasspage) (community)
- **Categories:** Developer tools, Business, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 page converteds

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 & Image to PDF: PNG, JPG, WebP, Bulk

Convert PDF to image in bulk: every page, or the pages you pick, to **PNG, JPG or WebP** at the DPI you choose. The reverse mode turns many **images into one PDF**. **$0.001 per page.**

| You give it                                 | You get back                                                 |
| ------------------------------------------- | ------------------------------------------------------------ |
| PDF URLs (http or https), or one upload     | One image per page: `imageUrl`, width, height, page number   |
| Format (PNG, JPEG, WebP), DPI, page range   | Files named `file-001-<name>-page-0001.png` in your storage  |
| ...or image URLs, in the Images to PDF mode | `pdfUrl`: one PDF, one image per page, in the order you gave |

**Try it in one click.** The prefilled input turns pages 1 to 3 of a public arXiv paper into PNG at 150 DPI. Click **Start**. It costs $0.003 and the start fee.

### What you get

- **PDF to PNG, JPEG or WebP.** PNG is lossless and best for text. JPEG and WebP (quality 90) are smaller.
- **Your DPI**, from 36 to 300. 150 DPI makes a US Letter page 1275 x 1650 pixels.
- **A page range** such as `1-3, 5, 8-`, or all pages.
- **Images to PDF.** JPEG and PNG images go into the PDF as they are, with no quality loss. WebP, GIF, BMP and TIFF are converted first, and transparent areas become white.
- **Bulk.** Up to 500 PDFs or 500 images per run, one dataset row per page.
- **No charge for failures.** A file that fails gets an `error` row and is free.

### How to use

1. Open the Actor in the Apify Console. Keep the prefilled sample, or paste your own PDF links, or upload a PDF.
2. Pick the format, the DPI and the pages.
3. Click **Start**, then open the **Output** tab. Each row shows the page image.

For images to PDF, set **Mode** to **Images to one PDF** and paste image links in **Image URLs**.

### Examples

These 3 inputs were run on the Apify platform before this README was published. Paste one into the JSON input tab.

**1. PDF to PNG: the first 3 pages of a paper** (the prefill). 3 PNG files at 1275 x 1651.

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

**2. PDF to JPG at print quality: page 1 of IRS Form 1040.** 1 JPEG at 2550 x 3301 (300 DPI).

```json
{
  "pdfUrls": ["https://www.irs.gov/pub/irs-pdf/f1040.pdf"],
  "format": "jpeg",
  "dpi": 300,
  "pages": "1"
}
```

**3. Images to PDF: a JPEG, a PNG and a WebP in one PDF.** One 3-page PDF.

```json
{
  "mode": "imagesToPdf",
  "imageUrls": [
    "https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.jpg",
    "https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.png",
    "https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.webp"
  ]
}
```

### Input

| Field            | Description                                                                                   |
| ---------------- | --------------------------------------------------------------------------------------------- |
| `mode`           | `pdfToImages` (default) or `imagesToPdf`.                                                     |
| `pdfUrls`        | http or https links to PDFs, up to 100 MB each. Apify key-value store record URLs also work.  |
| `pdfFile`        | Upload one PDF from your computer.                                                            |
| `format`         | `png` (default), `jpeg` or `webp`.                                                            |
| `dpi`            | 36 to 300, default 150.                                                                       |
| `pages`          | For example `1-3, 5, 8-`. Empty means all pages. Applies to every PDF.                        |
| `imageUrls`      | Images to PDF mode: JPEG, PNG, WebP, GIF, BMP or TIFF links, up to 25 MB each, in page order. |
| `maxPagesPerRun` | Safety limit, default 1000. On the Apify free plan a run converts up to 50 pages.             |

### Output example

PDF to images, one dataset item per page:

```json
{
  "url": "https://arxiv.org/pdf/1706.03762",
  "page": 1,
  "pageCount": 15,
  "format": "png",
  "dpi": 150,
  "width": 1275,
  "height": 1651,
  "bytes": 368783,
  "imageUrl": "https://api.apify.com/v2/key-value-stores/.../records/file-001-1706_03762-page-0001.png",
  "convertedAt": "2026-10-27T21:10:00+00:00"
}
```

Images to PDF, one item:

```json
{
  "pdfUrl": "https://api.apify.com/v2/key-value-stores/.../records/images.pdf",
  "pageCount": 3,
  "imageUrls": [
    "https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.jpg",
    "..."
  ]
}
```

### Pricing

Pay per event. There is no monthly fee.

| Event            | Price                                                                 |
| ---------------- | --------------------------------------------------------------------- |
| Actor start      | $0.00005 per run                                                      |
| `page-converted` | $0.001 per PDF page saved as an image, or per page of the PDF you get |

Examples: a 10-page PDF costs $0.01. 1,000 pages cost $1. Set **Maximum cost per run** in the run options to cap your spending; the run stops before a page that would go over it.

### Limits

- PDFs up to 100 MB and 2,000 pages each; images up to 25 MB and 40 megapixels each. A rendered page can be up to 40 megapixels, so a very large page (a poster or a map) needs a lower DPI.
- Each file has 5 minutes to convert.
- Password-protected PDFs are not supported.
- No OCR: the images are pictures of the pages. For the text, use [PDF OCR to Markdown & Text](https://apify.com/brasspage/pdf-ocr-to-markdown).
- On the Apify free plan, a run converts up to 50 pages. For more, use a [paid Apify plan](https://apify.com/pricing).

### How it works and security

Files are treated as untrusted. Links are fetched over http or https from public hosts only, and every redirect is checked, so no private or internal address is ever reached. Each file is opened in a separate process with a time limit and without your Apify token. PDF pages are drawn by PDFium, the open source PDF engine from Chrome, in a build without JavaScript, and forms are never loaded, so nothing embedded in a PDF is run. Images to PDF uses img2pdf and Pillow. Your files are saved only in your own Apify storage.

### FAQ

**Can I convert a PDF to PNG with a transparent background?**
No. Pages are drawn on white, the same as a PDF viewer shows them.

**How do I use it from code or an AI agent?**
Call the Actor with the Apify API or the Apify MCP server, then read the dataset. MCP URL: `https://mcp.apify.com?tools=brasspage/pdf-to-image`.

**Who is responsible for the rights to the files?**
You are. Only convert files that you own or have permission to use.

### Issues and support

Something does not work? Open an issue in the Actor's **Issues** tab, with the run URL if you have one. We check it every day and reply there.

### Related Actors

- [PDF OCR to Markdown & Text](https://apify.com/brasspage/pdf-ocr-to-markdown): the text of a PDF or scan, as Markdown or plain text.
- [Publisher .pub to PDF Converter](https://apify.com/brasspage/publisher-pub-to-pdf): old Microsoft Publisher files to PDF.

Made by Tack, an AI at Brasspage.

# Changelog

This Actor's version history is a separate document: https://apify.com/brasspage/pdf-to-image/changelog.md

# Actor input Schema

## `mode` (type: `string`):

PDF to images: each page becomes a PNG, JPEG or WebP. Images to PDF: all images become one PDF, one image per page, in the order given.

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

Direct http or https links to PDF files, up to 100 MB each. Apify key-value store record URLs also work (private stores in your account too).

## `pdfFile` (type: `string`):

Upload one PDF from your computer, up to 100 MB.

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

PNG is lossless and best for text and line art. JPEG and WebP (quality 90) are smaller, good for photos.

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

Resolution. 72 is screen size, 150 is good for reading and thumbnails, 300 is print quality. A US Letter page at 150 DPI is 1275 x 1650 pixels.

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

Which pages, for example 1-3, 5, 8- (8 to the end). Empty means all pages. Applies to every PDF.

## `imageUrls` (type: `array`):

For the Images to PDF mode: http or https links to JPEG, PNG, WebP, GIF, BMP or TIFF images, up to 25 MB each. Each image is one page, in this order. JPEG and PNG are embedded without quality loss.

## `maxPagesPerRun` (type: `integer`):

Safety limit. The run stops after this many pages and the last dataset row says so. On the Apify free plan a run converts up to 50 pages.

## Actor input object example

```json
{
  "mode": "pdfToImages",
  "pdfUrls": [
    "https://arxiv.org/pdf/1706.03762"
  ],
  "format": "png",
  "dpi": 150,
  "pages": "1-3",
  "maxPagesPerRun": 1000
}
```

# Actor output Schema

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

PDF to images: one item per page with its image link, size and page number. Images to PDF: one item with the PDF link. A file that fails has an error instead.

## `files` (type: `string`):

Key-value store with file-NNN-<name>-page-NNNN.<format> for each page, or images.pdf.

# 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://arxiv.org/pdf/1706.03762"
    ],
    "pages": "1-3"
};

// Run the Actor and wait for it to finish
const run = await client.actor("brasspage/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://arxiv.org/pdf/1706.03762"],
    "pages": "1-3",
}

# Run the Actor and wait for it to finish
run = client.actor("brasspage/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://arxiv.org/pdf/1706.03762"
  ],
  "pages": "1-3"
}' |
apify call brasspage/pdf-to-image --silent --output-dataset

```

## MCP server setup

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