Make a PDF from JPG and PNG images
pdf_image_to_pdfConvert JPG and PNG images into a single PDF, one image per page in the order given. Choose fit-to-image or A4/Letter pages with margins; phone photos are rotated upright.
Instructions
Make a PDF from JPG and PNG images: one image per page, in the order given. Each image is a local path (.png, .jpg, .jpeg), an https:// URL or a data:image/jpeg;base64,… or data:image/png;base64,… URI; the type is detected from the bytes, not the name. At most 100 images, each up to 4 MB, 4.5 MB in total. page_size "fit" (default) makes each page the image's own size at 72 dpi (1 px = 1 pt; pages longer than 5,000 pt on a side are scaled down, tiny images are enlarged to a 3 pt minimum); "a4" or "letter" put the image on a standard page, centred, shrunk to fit inside the margin and never enlarged. orientation (auto, portrait, landscape; default auto picks per image) applies to a4 and letter only. margin is 0-200 pt (default 0 for fit, where the page grows by the margin on every side; 36 for a4 and letter). A JPEG's EXIF orientation is applied, so phone photos come out upright. PNG: 8-bit and 16-bit, palette, grey, interlaced and transparent files work (transparency is kept); animated PNGs, other formats (GIF, WebP, HEIC, TIFF, SVG) and PDFs are rejected. JPEG: baseline and progressive, grey, RGB and Adobe-style CMYK. Very large images fail with image_too_large (PNG over 10 megapixels or a memory estimate; JPEG over 250 megapixels), and many large PNGs in one call with images_too_large_together. Deterministic: the same images give byte-identical output. To join images with existing PDFs use pdf_merge, which also accepts images. Returns the result written to output_path, or inline as an application/pdf resource when output_path is omitted (results over 7 MB are never returned inline: pass output_path); an existing file at output_path is overwritten. The source is never modified.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"image_paths": "<image_paths>"
},
"name": "pdf_image_to_pdf"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| margin | No | Points, 0-200. Default 0 for fit, 36 for a4 and letter. | |
| page_size | No | fit (default): page = image size. a4 or letter: standard page, image centred and shrunk to fit. | |
| image_paths | Yes | In order, one page each: a local path (.png, .jpg, .jpeg) inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:image/jpeg;base64,… / data:image/png;base64,… URI. | |
| orientation | No | a4 and letter only; auto (default) picks portrait or landscape per image. | |
| output_path | No | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Omit when running remotely: the PDF is then returned inline as an application/pdf resource for the client to save. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bytes | Yes | Size of the produced PDF in bytes | |
| output_path | No | Absolute path written, when output_path was supplied | |
| resource_uri | No | pdfops:// uri of the inline application/pdf resource, when output_path was omitted |