# Images to PDF: Combine Image URLs into a PDF (`ucchiii/images-to-pdf`) Actor

Turn public image URLs (JPG, PNG, WebP, GIF, BMP, TIFF) into one combined PDF or one PDF per image. Choose A4, Letter or fit-to-image pages, orientation and margin. Each PDF gets a download link, page count and size. Empty input = free demo.

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

## Pricing

from $2.10 / 1,000 pdf pages

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

**Images to PDF: turn image URLs into one combined PDF or one PDF per image, with A4, Letter or fit-to-image pages**

Office teams that collect scans, receipts, product photos or screenshots as image links, and developers who need a PDF from a list of images, all hit the same problem: the images are online, the recipient wants a single PDF, and opening each file in a desktop tool does not scale. Paste the image links, pick the page size, and press Start. The PDF is saved in the run's storage with a download link, and the dataset row tells you the page count and file size.

### What you get

| status | fileName | pages | bytes | pageSize | downloadUrl | sourceUrls |
|---|---|---|---|---|---|---|
| ok | invoices-2026.pdf | 3 | 412,904 | a4 | https://api.apify.com/v2/key-value-stores/.../records/invoices-2026.pdf | \["https://example.com/1.jpg", ...] |
| failed | | 0 | 0 | | | \["https://example.com/missing.png"] *(error: The server answered HTTP 404 ...)* |

**Try it free:** leave the image list empty and press **Start**. Two built-in sample images (landscape and portrait) become one 2-page A4 PDF. Not charged; the row carries `_demo: true`.

### How to use

1. **Image URLs**: public links to JPG, PNG, WebP, GIF, BMP or TIFF images, one per line, in the order you want the pages.
2. **Output**: one combined PDF (default) or one PDF per image.
3. **Page size**: A4, US Letter, or Fit to image (each page is exactly as large as its image, plus margin).
4. Optional: **Orientation** (auto, portrait, landscape), **Margin** in mm, **Image compression**, **JPEG quality**, **Output file name**.

```json
{
  "imageUrls": ["https://example.com/page-1.jpg", "https://example.com/page-2.png"],
  "outputMode": "combined",
  "pageSize": "a4",
  "orientation": "auto",
  "marginMm": 10,
  "outputFileName": "invoices-2026"
}
```

### How the PDF is made

- **Aspect ratio is kept.** On A4 and Letter each image is scaled to fit inside the margins and centered. Auto orientation turns wide images to landscape pages and tall images to portrait pages.
- **JPG files are stored as they are**, without re-compression, so quality and size stay the same. PNG, GIF, BMP, WebP and TIFF are stored without quality loss. Choose *Re-compress everything as JPEG* for a much smaller PDF (transparency becomes white).
- **Photo orientation** from the camera (EXIF) is applied, so portrait photos stay upright.
- **Metadata is not copied**: EXIF data such as camera details and GPS location does not end up in the PDF.
- **Animated GIFs and multi-page TIFFs**: the first frame or page is used.
- **Transparency** is placed on a white page background.
- File names: combined mode uses your output file name (default `images.pdf`); per-image mode names files `0001-<image name>.pdf`, or `<your name>-0001.pdf` when you set a file name.

### Output fields

- `status` (`ok` or `failed`), `error` (the reason when an image failed)
- `fileName`, `downloadUrl`: the PDF in the run's key-value store
- `pages`, `bytes`, `pageSize`, `orientation`, `marginMm`
- `sourceUrls`: the image URLs placed in this PDF (one for a failed image or a per-image PDF)

A **STATS** record sums up PDFs made, pages charged, images failed or skipped and the options used. Download the rows as CSV, Excel or JSON from the run page.

### Limits (cannot be raised by input)

- 500 image URLs per run; 25 MB per image; 50 megapixels per image (protection against "decompression bomb" files); 200 MB of images per run
- Polite downloading: at most 4 downloads at once, 2 per website at once, and at least 0.5 seconds between requests to the same website
- Public images only (no login); links to internal network addresses are blocked
- HEIC, SVG and password-protected files are not supported
- Set a maximum charge per run to cap spend: the run stops cleanly when it is reached and keeps the pages made so far

### Pricing

Pay per event: **$0.003 per PDF page** (one image = one page), the same for a 20 KB icon and a 25 MB photo. Failed downloads, unreadable or oversized images, invalid input and the demo are free.
Store discounts apply automatically: BRONZE −10%, SILVER −20%, GOLD −30%.

### Your responsibility

You supply the image links and you are responsible for having the right to download and convert those images (copyright, license, the terms of the website that hosts them). This Actor only fetches the links you give it, one request each, and never browses or crawls.

### FAQ

**Can I merge images and existing PDFs?** No. Input is images only.

**Can I put several images on one page?** Not yet. Each image gets its own page.

**How long are the files kept?** As long as the run's storage is kept under your Apify plan's data retention. Download them or copy them to your own storage if you need them longer.

**Open-source libraries used:** Pillow (HPND) and reportlab (BSD) for image handling and PDF writing.

If this Actor saved you time, a rating on the Store helps others find it.

### More tools from the same developer

- [Image Converter](https://apify.com/ucchiii/image-converter) — convert images between JPG, PNG, WebP and AVIF, with optional resize
- [URL to PDF](https://apify.com/ucchiii/url-to-pdf) — save public web pages as PDF files: A4 or Letter, margins, page numbers
- [Bulk File Downloader](https://apify.com/ucchiii/bulk-file-downloader) — download files from URL lists or dataset fields into storage, with links, SHA-256 and an optional ZIP
- [Website Image Extractor](https://apify.com/ucchiii/website-image-extractor) — every image on your pages with alt text, srcset, size and type (HEAD only), flagging missing alt and oversized images
- [Tesseract OCR](https://apify.com/ucchiii/ocr-image-text) — OCR for image URLs and scanned PDFs with built-in Tesseract: text, confidence and line boxes in 8 languages

# Actor input Schema

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

Public http(s) links to JPG, PNG, WebP, GIF, BMP or TIFF images, one per line, in page order (up to 500 per run, 25 MB and 50 megapixels each). Only use images you have the right to convert. Leave empty for a free demo on 2 built-in sample images.

## `outputMode` (type: `string`):

Combined puts all images into a single PDF in the order given. Per image makes a separate one-page PDF for each image.

## `pageSize` (type: `string`):

A4 and Letter scale each image to fit the page, keeping the aspect ratio. Fit makes every page exactly as large as its image (plus margin).

## `orientation` (type: `string`):

Auto turns the page to landscape for wide images and portrait for tall ones. Ignored for Fit to image.

## `marginMm` (type: `number`):

Empty border around the image on every page, in millimetres. Use 0 for full-bleed pages.

## `imageEncoding` (type: `string`):

Auto keeps JPG files untouched and stores PNG, GIF, BMP, WebP and TIFF without quality loss. JPEG makes smaller PDFs; transparency becomes white.

## `jpegQuality` (type: `integer`):

1-100, used only when Image compression is set to JPEG. Lower = smaller PDF.

## `outputFileName` (type: `string`):

Optional name for the PDF without the .pdf ending, for example invoices-2026. Combined: the file name. Per image: the start of each name, followed by a number. Default: images.

## Actor input object example

```json
{
  "imageUrls": [
    "https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.png"
  ],
  "outputMode": "combined",
  "pageSize": "a4",
  "orientation": "auto",
  "marginMm": 10,
  "imageEncoding": "auto",
  "jpegQuality": 85
}
```

# Actor output Schema

## `pdfs` (type: `string`):

One row per PDF: download link, page count, file size and source image URLs, plus one row for each image that failed with the reason.

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

The key-value store that holds the PDF files.

## `stats` (type: `string`):

Record STATS: PDFs made, pages charged, images failed and skipped, the options used and whether the run stopped early.

# 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 = {
    "imageUrls": [
        "https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.png"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ucchiii/images-to-pdf").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 = { "imageUrls": ["https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.png"] }

# Run the Actor and wait for it to finish
run = client.actor("ucchiii/images-to-pdf").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 '{
  "imageUrls": [
    "https://raw.githubusercontent.com/python-pillow/Pillow/main/Tests/images/hopper.png"
  ]
}' |
apify call ucchiii/images-to-pdf --silent --output-dataset

```

## MCP server setup

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

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/sk7RDQ6lohgY5yA4q/builds/YTa6AtPSSeCItFhtx/openapi.json
