# PDF to Images Converter (PNG, JPG, WebP, Thumbnails) (`freecamp008/pdf-to-images`) Actor

Convert PDF pages to high-quality PNG, JPEG or WebP images at any DPI or pixel width. Page ranges, thumbnails, transparent backgrounds and public image URLs. Self-hosted pdf.js renderer, no external APIs.

- **URL**: https://apify.com/freecamp008/pdf-to-images.md
- **Developed by:** [Camp8 fr0](https://apify.com/freecamp008) (community)
- **Categories:** Developer tools, Automation, AI
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 page rendereds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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 Converter – PDF to PNG, JPG & WebP at Any DPI (with Thumbnails)

**PDF to Images** converts the pages of any PDF into high-quality **PNG, JPEG or WebP** images. Pick the resolution (DPI) or an exact pixel width, choose page ranges, generate thumbnails, keep a transparent background, and get a **public URL for every page image**. Rendering uses Mozilla's pdf.js engine running inside the Actor: no external APIs, no per-page fees to third parties, and your documents never leave Apify.

### What does PDF to Images do?

- 🖼️ **Renders every page** (or a page range like `1-3,7,10-`) to PNG, JPEG or WebP.
- 🎯 **Exact sizing**: choose DPI (24-600) or a fixed pixel width; the height follows the page aspect ratio.
- 🧩 **Thumbnails**: optional small preview image per page, stored next to the full image.
- 🫥 **Transparent background** for PNG and WebP (great for overlays, stamps and design work).
- 🔐 **Encrypted PDFs** supported with a password.
- 🧪 **Faithful rendering of real-world PDFs**: embedded and standard fonts, CJK cmaps, vector graphics, JPEG / JPEG 2000 / JBIG2 / CCITT scanned images, ICC colour profiles, annotations and filled form fields, rotated pages and `UserUnit` (posters, CAD sheets).
- 🛡️ **Safe on huge pages**: posters and maps are automatically rendered at the highest safe resolution instead of crashing.
- 🌐 **HTTP API (Standby mode)** with optional base64 output for one-request conversions.

### Use cases

- **Thumbnails and previews** for document management systems, CMSs and e-commerce catalogs
- **Feeding vision models / OCR / multimodal LLMs** with page images
- **Social media and blog images** from PDF reports, brochures and slide decks
- **Archiving** and visual regression tests of generated PDFs
- Converting **scanned PDFs** back into image files

### How to use it

1. Click **Try for free**.
2. Paste one or more **PDF URLs**.
3. Choose **pages**, **format** and **DPI** (or **width**). Optionally enable **thumbnails**.
4. Click **Start**. Each page appears as a row with a preview in the **Page images** view; the image files are in the run's key-value store with public URLs.

#### Call it as an HTTP API (Standby mode)

```bash
## GET with query parameters
curl "https://<your-standby-url>/?pdfUrls=https://example.com/report.pdf&pages=1-2&format=webp&width=1200" \
  -H "Authorization: Bearer <APIFY_TOKEN>"

## POST with a JSON body (same fields as the Actor input), images inline as base64
curl -X POST "https://<your-standby-url>/" \
  -H "Authorization: Bearer <APIFY_TOKEN>" -H "Content-Type: application/json" \
  -d '{"pdfUrls":["https://example.com/report.pdf"],"pages":"1","format":"png","dpi":200,"returnBase64":true}'
```

Response: `{ "count": 2, "items": [ ...one item per page... ] }`

You can also use the Apify API (`run-sync-get-dataset-items`), the Apify MCP server, Make, Zapier, n8n and other integrations. **AI agents can pay per call with x402 (USDC)** through Apify's agentic payments, without needing an Apify account.

### Input example

```json
{
  "pdfUrls": ["https://raw.githubusercontent.com/mozilla/pdf.js/master/web/compressed.tracemonkey-pldi-09.pdf"],
  "pages": "1-3",
  "format": "png",
  "dpi": 150,
  "thumbnails": true,
  "thumbnailWidth": 200
}
```

| Field | Description |
|---|---|
| `pdfUrls` | Direct links to PDF files (also `data:application/pdf;base64,...`) |
| `pages` | Page selection like `1-3,5,10-` (empty = all pages) |
| `format` | `png` (lossless), `jpeg` or `webp` |
| `dpi` | 24-600, default 150. Ignored when `width` is set |
| `width` | Exact output width in pixels (optional) |
| `quality` | JPEG/WebP quality 1-100 (default 85) |
| `transparentBackground` | Transparent instead of white page background (PNG/WebP) |
| `thumbnails` / `thumbnailWidth` | Also create a thumbnail per page |
| `maxPagesPerPdf` | Safety limit per document (default 500) |
| `password` | Password for encrypted PDFs |
| `returnBase64` | Standby API only: include the image bytes as base64 |

### Output example

```json
{
  "pdfUrl": "https://raw.githubusercontent.com/mozilla/pdf.js/master/web/compressed.tracemonkey-pldi-09.pdf",
  "page": 1,
  "pageCount": 14,
  "imageUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/compressed-tracemonkey-pldi-09-fa00f99e85f0-page-0001-png",
  "key": "compressed-tracemonkey-pldi-09-fa00f99e85f0-page-0001-png",
  "format": "png",
  "contentType": "image/png",
  "width": 1275,
  "height": 1650,
  "dpi": 150,
  "bytes": 733550,
  "thumbnailUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/compressed-tracemonkey-pldi-09-fa00f99e85f0-page-0001-png-thumb",
  "pageWidthPt": 612,
  "pageHeightPt": 792,
  "rotation": 0,
  "renderMs": 189
}
```

### Pricing

This Actor uses **pay-per-event** pricing. You only pay for pages that were rendered:

| Event | Price |
|---|---|
| Page rendered (thumbnail included) | **$1 per 1,000 pages** ($0.001 each) |

Failed downloads, broken PDFs and wrong passwords are free. Apify platform usage (compute) is billed separately and is typically a fraction of a cent per document. Set **Maximum cost per run** to cap your spend; the Actor stops cleanly when the limit is reached.

### FAQ

**Which DPI should I use?**
72 DPI gives screen size (a Letter page = 612 x 792 px), 150 DPI is a good default for previews and LLM vision, 300 DPI is print/OCR quality. Very large pages (posters, maps) are automatically capped at about 80 megapixels; such items carry `"downscaled": true`.

**Which format is best?**
PNG for text, diagrams and anything you will OCR. JPEG for scanned/photo pages when size matters. WebP is usually the smallest at the same visual quality and supports transparency.

**Are fonts and scanned images rendered correctly?**
Yes. Embedded fonts, the 14 standard PDF fonts, CJK character maps, JPEG, JPEG 2000, JBIG2 and CCITT images and ICC colour profiles are all supported by the bundled pdf.js build.

**How big can PDFs be?**
Up to 200 MB per file and 5,000 pages (default limit 500, configurable). Memory: 1 GB is enough for normal documents at up to 300 DPI; use 2-4 GB for 600 DPI or poster-size pages.

**Where are the images stored and how long?**
In the run's default key-value store, with public URLs in each dataset item. Retention follows your Apify plan's storage retention. Download them or copy them to your own storage if you need them longer.

**Is my data private?**
Files are processed inside your Apify run. Nothing is sent to third-party services.

**What about XFA (dynamic) forms?**
Pure XFA forms (LiveCycle "Please wait..." documents) have no regular page content, so only the placeholder page is rendered. Hybrid AcroForm/XFA forms (most government forms) render normally.

**Licenses?**
pdf.js (Apache-2.0) with its OpenJPEG (BSD-2), PDFium JBIG2 (BSD-3) and qcms (MIT) decoders, and @napi-rs/canvas / Skia (MIT/BSD). All are commercial-use friendly.

# Actor input Schema

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

Direct links to PDF files (or <code>data:application/pdf;base64,...</code> URLs). Every rendered page becomes one result with a public image URL.

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

Page selection like <code>1-3,5,10-</code>. Leave empty for all pages.

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

<b>png</b>: lossless, best for text and line art. <b>jpeg</b>: smallest for photos and scans. <b>webp</b>: small and sharp, supports transparency.

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

Render resolution in dots per inch. 72 = screen size, 150 = good quality, 300 = print/OCR quality. Ignored when <b>Width</b> is set.

## `width` (type: `integer`):

Optional: render every page to exactly this width in pixels (height follows the page aspect ratio). Overrides DPI.

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

Compression quality for JPEG and WebP (1-100). Ignored for PNG.

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

Keep the page background transparent instead of white (PNG and WebP only).

## `thumbnails` (type: `boolean`):

Also store a small thumbnail of every page (same format) and return its URL.

## `thumbnailWidth` (type: `integer`):

Width of thumbnails in pixels.

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

Safety limit on pages rendered per PDF.

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

Password for encrypted PDFs (optional).

## `returnBase64` (type: `boolean`):

Standby HTTP API only: also include each image as a base64 string (<code>imageBase64</code>) in the response. Ignored in normal runs, where only URLs are stored.

## Actor input object example

```json
{
  "pdfUrls": [
    "https://raw.githubusercontent.com/mozilla/pdf.js/master/web/compressed.tracemonkey-pldi-09.pdf"
  ],
  "pages": "1-3",
  "format": "png",
  "dpi": 150,
  "quality": 85,
  "transparentBackground": false,
  "thumbnails": false,
  "thumbnailWidth": 200,
  "maxPagesPerPdf": 500,
  "returnBase64": false
}
```

# Actor output Schema

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

No description

## `files` (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": [
        "https://raw.githubusercontent.com/mozilla/pdf.js/master/web/compressed.tracemonkey-pldi-09.pdf"
    ],
    "pages": "1-3"
};

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

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

```

## MCP server setup

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