# Image to PDF Converter (JPG, PNG, WebP to PDF, Bulk) (`toowl/image-to-pdf`) Actor

Convert images to PDF in bulk from URLs: combine many photos or scans into one PDF, or one PDF per image. A4, Letter or fit-to-image pages, auto orientation, margins, EXIF rotation, size-friendly JPEG. Pay per image.

- **URL**: https://apify.com/toowl/image-to-pdf.md
- **Developed by:** [Chalid Ade](https://apify.com/toowl) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 images converted

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/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

## Image to PDF Converter — JPG, PNG, WebP to PDF in bulk

Got a pile of photos, receipts or phone scans? Give this Actor the image URLs and get back **one tidy PDF** with a page per image, or **one PDF per image**, whichever you need. Pages are A4, Letter, Legal, A5 or exactly the image size, turned sideways automatically for landscape photos.

Great for expense receipts, scanned contracts, ID and KYC documents, delivery photos, product sheets and photo albums. Also handy as a step in Make, Zapier or n8n: "new images in a folder → one PDF in Drive".

### What you get

- **One combined PDF** in your order, or **one PDF per image** (plus a ZIP)
- **JPG, PNG, WebP, AVIF, TIFF, GIF and SVG** in, a standard PDF out
- **A4, Letter, Legal, A5 or fit-to-image** pages, with auto, portrait or landscape orientation
- **Contain or cover** placement, margins in mm
- **Phone photos come out upright** (EXIF rotation applied)
- **Small files**: images capped at 300 dpi for A4 and re-encoded as JPEG (quality adjustable); optional **black and white** for scans
- PNG transparency kept on request

### Input

```json
{
  "files": [
    { "url": "https://example.com/receipt-1.jpg" },
    { "url": "https://example.com/receipt-2.png" }
  ],
  "mode": "merge",
  "outputName": "expenses-november",
  "pageSize": "a4",
  "orientation": "auto",
  "marginMm": 10
}
```

### Output

One dataset row per image, plus a last row with the combined PDF:

```json
{
  "name": "expenses-november.pdf",
  "combined": true,
  "pages": 2,
  "sizeKb": 412.6,
  "pdfUrl": "https://api.apify.com/v2/key-value-stores/…/records/expenses-november.pdf"
}
```

The `SUMMARY` record in the key-value store carries the same link. In one-per-image mode each row has its own `pdfUrl`, and `pdfs.zip` holds them all.

### Pricing

Pay per event: one `image-converted` per image that made it into a PDF. Images that fail (broken link, not an image, too big) are free. Cap spending with "Max cost per run".

### Free browser version

Doing it once? [toowl.my.id/en/image-to-pdf](https://toowl.my.id/en/image-to-pdf/) turns images into a PDF in your browser for free, without uploading them.

### Call it from your code

```bash
curl -X POST "https://api.apify.com/v2/acts/toowl~image-to-pdf/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"files":[{"url":"https://example.com/a.jpg"},{"url":"https://example.com/b.jpg"}],"mode":"merge"}'
```

The same call works from Python (`apify-client`), JavaScript, Make, Zapier and n8n (Apify app/node or a plain HTTP request).

### Use it from AI agents (MCP)

Add this Actor as a tool to Claude, Cursor, VS Code or any MCP client through Apify's MCP server:

```
https://mcp.apify.com/?actors=toowl/image-to-pdf
```

The agent can then pass file URLs and read the results itself.

### More toowl file APIs

Speech to text & subtitles, AI vocal remover, text to speech, AI object remover, PDF to Markdown, PDF to Word & Excel, HTML/URL to PDF, OCR, Office to PDF, PDF compressor, PDF merge/split, PDF password protect, PDF to image, image to PDF, bulk watermark, image converter and compressor, background remover, AI upscaler, image to SVG, QR code and barcode generators, QR/barcode reader, favicon generator, video compressor, frame extractor and audio converter. All pay per file, all batch-friendly: [toowl.my.id/en/api](https://toowl.my.id/en/api/).

Questions or a format that fails? Open an issue on the Actor's **Issues** tab.

# Actor input Schema

## `files` (type: `array`):

JPG, PNG, WebP, AVIF, TIFF, GIF or SVG links. In one-PDF mode the pages follow this order.

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

Combine every image into one PDF (scans, receipts, photo albums), or make one PDF per image.

## `outputName` (type: `string`):

Name of the combined PDF (one-PDF mode). Also used as the PDF title.

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

Paper size, or a page exactly the size of each image.

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

Auto turns the page sideways for landscape images.

## `fit` (type: `string`):

Contain shows the whole image; cover fills the page and crops the edges.

## `marginMm` (type: `integer`):

Blank border around each image.

## `maxImagePx` (type: `integer`):

Longest side of each image in the PDF. 2480 px = A4 at 300 dpi; lower makes smaller files.

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

30–100. 85 looks like the original at a fraction of the size.

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

Good for document scans: smaller files, cleaner print.

## `keepTransparency` (type: `boolean`):

PNG with transparency stays PNG (bigger). Off = flattened onto white.

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

Larger files are skipped with an error (not charged).

## Actor input object example

```json
{
  "files": [
    {
      "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/invoice.jpg"
    },
    {
      "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/small-photo.jpg"
    }
  ],
  "mode": "merge",
  "outputName": "images",
  "pageSize": "a4",
  "orientation": "auto",
  "fit": "contain",
  "marginMm": 10,
  "maxImagePx": 2480,
  "quality": 85,
  "grayscale": false,
  "keepTransparency": false,
  "maxFileSizeMb": 50
}
```

# Actor output Schema

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

One row per image; the combined PDF (or each image's own PDF) has a download link.

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

PDFs in the default key-value store, plus a SUMMARY record with the combined PDF's link.

# 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 = {
    "files": [
        {
            "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/invoice.jpg"
        },
        {
            "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/small-photo.jpg"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("toowl/image-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 = { "files": [
        { "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/invoice.jpg" },
        { "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/small-photo.jpg" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("toowl/image-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 '{
  "files": [
    {
      "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/invoice.jpg"
    },
    {
      "url": "https://raw.githubusercontent.com/chalidade/tools/main/apify/samples/small-photo.jpg"
    }
  ]
}' |
apify call toowl/image-to-pdf --silent --output-dataset

```

## MCP server setup

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