# Images to PDF — Combine Photos into One PDF (`hipersoft/images-to-pdf`) Actor

Bundle JPG and PNG images into a single paginated PDF, with page size and fit options. Turn scans, screenshots and product shots into a shareable document.

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

## Pricing

from $0.0025 / pdf created

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Images to PDF — Combine Photos into One PDF

**Bundle JPG and PNG images into a single paginated PDF** — with page-size and margin options. Turn scans, screenshots, receipts and product shots into one shareable, printable document in a single run.

### What it does

- Combines a list of **JPG/PNG** images into one PDF, in order.
- **Fit-to-image**, **A4** or **US Letter** page sizes, with optional margins.
- Centers and scales each image to the page.

### Use cases

- **Scanning** — turn phone photos of documents into a PDF.
- **Receipts / expenses** — bundle receipt images for submission.
- **Portfolios / catalogs** — assemble product shots into a PDF.

### Input

```json
{ "imageUrls": ["https://example.com/scan1.jpg", "https://example.com/scan2.png"], "pageSize": "a4", "margin": 20 }
```

| Field | Type | Description |
|---|---|---|
| `imageUrls` | array | JPG/PNG URLs, in page order. |
| `pageSize` | string | `fit`, `a4` or `letter`. |
| `margin` | integer | Margin around each image (points). |
| `outputName` | string | Output filename. |

### Output

```json
{ "imageCount": 2, "pages": 2, "resultUrl": "https://api.apify.com/v2/key-value-stores/.../records/images.pdf", "ok": true }
```

#### Output schema

| Field | Type | Description |
|---|---|---|
| `imageCount` | integer | Images added. |
| `pages` | integer | Pages in the PDF. |
| `resultUrl` | string (URL) | Link to the output PDF. |

### FAQ

**Which formats?** JPG and PNG.

**Can I automate it?** Yes — via [integrations on the Apify platform](https://apify.com/integrations) and the [Apify API](https://docs.apify.com/api/v2).

### Notes

Original clean-room implementation. Pairs with [PDF Merge](https://apify.com/hipersoft/pdf-merge) and [PDF Split](https://apify.com/hipersoft/pdf-split).

# Actor input Schema

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

JPG/PNG image URLs, in the order they should appear as pages.

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

Fit each page to the image, or use a fixed page size.

## `margin` (type: `integer`):

Margin around each image in points.

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

Name for the output PDF.

## Actor input object example

```json
{
  "imageUrls": [
    "https://example.com/scan1.jpg",
    "https://example.com/scan2.png"
  ],
  "pageSize": "fit",
  "margin": 0,
  "outputName": "images.pdf"
}
```

# Actor output Schema

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

The results as dataset items.

# 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://picsum.photos/id/10/800/1000",
        "https://picsum.photos/id/20/800/1000"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("hipersoft/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://picsum.photos/id/10/800/1000",
        "https://picsum.photos/id/20/800/1000",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("hipersoft/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://picsum.photos/id/10/800/1000",
    "https://picsum.photos/id/20/800/1000"
  ]
}' |
apify call hipersoft/images-to-pdf --silent --output-dataset

```

## MCP server setup

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