# Images to PDF

Put 1 to 50 pictures into one PDF, one picture on each page. Pages fit the picture, or use A4 or Letter with a margin.

- Endpoint: `POST https://setget.net/v1/tools/images-to-pdf` with JSON `{"input": {...}}` (add `"wait": 30` to hold the reply until the job finishes)
- MCP: `run_tool` with `slug` = `images-to-pdf`
- Page: https://setget.net/tools/images-to-pdf

## Files in, files out

This is a file tool. Its file inputs take file references, not file contents and not web addresses.

- Get a reference by uploading: `curl -T FILE https://setget.net/drop/` prints a line `ref  <id>/f1`. Or `POST https://setget.net/v1/drops` with `{"files":[{"name","size"}]}`, PUT the bytes to the returned `upload.url` with the listed headers, and use the file's `ref`. Over MCP use the `drop` tool. A file under about 700 KB can also be sent in place as a `data:<type>;base64,<content>` URI.
- Uploads are at most 100 MB per file, are readable by anyone with the link, and expire (one hour by default). Programs are refused.
- The tool runs as a job. The reply is `{"tool", "ms", "result", "files", "job"}`: `result` is JSON, and every result file comes back in `files` as `{"name", "size", "content_type", "kind", "url", "ref"}`. Download it from `url`, or pass `ref` as the input of another file tool.
- A job still running when the wait ends answers 202 with `job`. Follow it with `GET https://setget.net/v1/jobs/<id>?wait=30`, or stream progress from `GET https://setget.net/v1/jobs/<id>/events` (over MCP: the `job` tool). A person can watch it at `job.url`.

## Inputs

- `files` (required, files, a list of file references such as `["DROP_ID/f1"]`, at most 50, accepts image): The pictures, in page order. PNG, JPG, WebP, GIF, TIFF, BMP and HEIC work.
- `page_size` (optional, string, one of `fit`, `a4`, `letter`, default `"fit"`): fit makes each page exactly as large as its picture. a4 and letter place each picture as large as it fits on that paper, centred.
- `orientation` (optional, string, one of `auto`, `portrait`, `landscape`, default `"auto"`): For a4 and letter: auto turns the paper to match each picture; portrait and landscape use the same direction for every page.
- `margin` (optional, number, default `0`, range 0..50): White space around each picture, in millimetres.
- `compress` (optional, boolean, default `false`): Store every picture as a JPEG of good quality. This makes a much smaller PDF from scans and screenshots, with slightly softer edges. Off, pictures keep every pixel.

## Example 1: Two pictures, each on a page of its own size

Upload first. Each placeholder below stands for the reference of one upload: `DROP_1/f1` = [sample.jpg](https://setget.net/static/samples/sample.jpg), `DROP_2/f1` = [sample.png](https://setget.net/static/samples/sample.png).

```json
{"input":{"files":["DROP_1/f1","DROP_2/f1"]},"wait":30}
```

## Example 2: A photo on A4 with a margin

Upload first. Each placeholder below stands for the reference of one upload: `DROP_ID/f1` = [sample.jpg](https://setget.net/static/samples/sample.jpg).

```json
{"input":{"files":["DROP_ID/f1"],"page_size":"a4","margin":10},"wait":30}
```

## Example 3: Letter landscape, stored small

Upload first. Each placeholder below stands for the reference of one upload: `DROP_1/f1` = [sample-transparent.png](https://setget.net/static/samples/sample-transparent.png), `DROP_2/f1` = [sample.png](https://setget.net/static/samples/sample.png).

```json
{"input":{"files":["DROP_1/f1","DROP_2/f1"],"page_size":"letter","orientation":"landscape","compress":true},"wait":30}
```

**Do my pictures lose quality?** No, unless you turn compress on. JPEG photos are put into the PDF as they are, and other pictures keep every pixel.

**My phone photo is sideways in other tools. Here too?** No. The direction the camera recorded is applied, so photos come out upright.

**What happens to see-through areas?** They become white, because a PDF page is white paper.

**How large is a fit page?** As large as the picture at its own resolution, which pictures from scanners state. Where a picture states none, 96 pixels are taken as one inch.

**What are the limits?** 50 pictures, 50 megapixels for each picture and 400 megapixels together. An animated picture gives its first frame.
