# Image to PDF API

> Image to PDF combines up to 20 images, uploaded or fetched from URLs, into one PDF with one image per page, and returns a download link valid for 2 days. Pages can match each image or be A4, Letter or Legal with a margin, and multi-page TIFF scans and animated GIFs become one page per frame.

**Endpoint:** `POST https://api.apiverve.com/v1/imagetopdf`  
**Category:** Documents  
**Cost:** 10 credits per call  
**Canonical page:** https://apiverve.com/marketplace/imagetopdf

## Overview

JPG and PNG images are placed in the PDF exactly as they are, without re-compression, so the PDF keeps their full quality. HEIC, WebP, AVIF, BMP, GIF and TIFF images are converted first, and phone photos are turned upright from their EXIF orientation. Set quality to re-compress every image as JPG and make the PDF smaller.

On A4, Letter and Legal pages each image is scaled to fit inside the margins and centred, in portrait or landscape to match the image unless you choose an orientation. With pageSize fit, each page is the size of its image. The Free plan builds PDFs of up to 5 pages; paid plans build up to 100.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl -X POST "https://api.apiverve.com/v1/imagetopdf" \
  -H "x-api-key: YOUR_API_KEY" \
  -F "image=@photo.jpg" \
  -F "pageSize=a4" \
  -F "orientation=auto" \
  -F "margin=10" \
  -F "quality=80"
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `image` | string | No | An image file (upload one or more as multipart files, up to 20), base64 image data, or a public image URL |
| `urls` | array | No | A JSON array of public image URLs, added in order after image; a comma- or newline-separated list also works. Up to 20 images per call in all |
| `pageSize` | string | No | Page size: fit makes each page the size of its image; a4, letter and legal fit the image inside the margins. default a4. One of: fit, a4, letter, legal |
| `orientation` | string | No | Page orientation for a4, letter and legal; auto turns each page to match its image. Ignored for fit. default auto. One of: auto, portrait, landscape |
| `margin` | number | No | Margin around each image in millimetres, from 0 to 50. default 0. range 0-50 |
| `quality` | integer | No | Re-compress every image as JPG at this quality (1-100) to make the PDF smaller. Omit to keep JPG and PNG images unchanged. range 1-100 |

## Response fields

- `pdfName` — string · File name of the PDF
- `imageCount` — number · Number of images received
- `pageCount` — number · Pages in the PDF; more than imageCount when a GIF or TIFF has several frames
- `pageSize` — string · Page size used
- `orientation` — string · Orientation setting used; null for fit
- `margin` — number · Margin in millimetres
- `quality` — object · JPG quality images were re-compressed at, or null when they were kept unchanged
- `size` — number · Size of the PDF in bytes
- `expires` — number · When the download link expires (Unix time in milliseconds)
- `downloadURL` — string · Signed link to download the PDF, valid for 2 days

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "pdfName": "7c1e4b9a-2f3d-4e8a-9b6c-5d0a1f2e3c4b.pdf",
    "imageCount": 2,
    "pageCount": 2,
    "pageSize": "a4",
    "orientation": "auto",
    "margin": 10,
    "quality": null,
    "size": 483291,
    "expires": 1792400000000,
    "downloadURL": "https://storage.googleapis.com/apiverve/APIData/imagetopdf/7c1e4b9a-2f3d-4e8a-9b6c-5d0a1f2e3c4b.pdf?GoogleAccessId=635500398038-compute%40developer.gserviceaccount.com&Expires=1792400000&Signature=SAMPLE"
  }
}
```

## Use cases

- **Receipt and Expense Uploads** — Bundle photos of receipts taken on a phone into one PDF for an expense report or an accounting system.
- **Scanned Document Packs** — Turn multi-page TIFF scans or a set of page photos into a single PDF that any viewer can open.
- **Photo Books and Portfolios** — Assemble product shots or portfolio images into a PDF for clients, with consistent paper size and margins.
- **Form Attachments** — Accept images in an upload form and store or forward them as one PDF, the format many back-office systems require.

## More

- Full reference: https://docs.apiverve.com/ref/imagetopdf
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
