DOCIFY HOSTED API / NO API KEY

Free Image to PDF API

Put a single PNG, JPEG or WebP image onto an A4 or Letter PDF page from your script. Upload the raw image and download the PDF response. The image is fitted to the page without cropping.

Endpoint

POST https://docify.site/api/v1/image-to-pdf

Request Content-Type: image/png, image/jpeg or image/webp
Successful response: application/pdf, returned as a file attachment.

Try it with cURL

Run this from the folder containing your input file, where applicable. The examples use a POSIX shell. Windows PowerShell users can use curl.exe and adapt line continuation and JSON quoting.

curl -X POST "https://docify.site/api/v1/image-to-pdf?format=A4&orientation=auto&margin=10" \
  -H "Content-Type: image/png" \
  --data-binary @photo.png \
  --output photo.pdf

Query parameters

OptionAccepted values and behavior
formatA4 (default) or Letter.
orientationauto (default), portrait or landscape. Auto uses the input image proportions.
marginInteger from 0 to 40 millimeters. Default is 10.

Use it from a Node.js script

This example uses Node.js 20+ with built-in fetch. Save it as an .mjs file and run it with Node. Check the response status before saving the response as a file.

import { readFile, writeFile } from "node:fs/promises";

const response = await fetch(
  "https://docify.site/api/v1/image-to-pdf?format=A4&orientation=auto&margin=10",
  {
    method: "POST",
    headers: { "Content-Type": "image/png" },
    body: await readFile("photo.png"),
  },
);
if (!response.ok) throw new Error(await response.text());
await writeFile("photo.pdf", Buffer.from(await response.arrayBuffer()));

Input rules and limitations

  • Upload one raw image with a matching image/png, image/jpeg or image/webp Content-Type. No multipart form or JSON wrapper is needed.
  • The input limit is 20 MB. Animated images are rejected. Transparent image areas become white in the PDF.
  • The result contains one page. Make separate requests for separate PDF files. This endpoint does not merge a batch of images into a multi-page document.
  • Use the HTML to PDF endpoint when you need text, a certificate layout or additional content around an embedded image.

Errors, rate limits and data handling

The public service needs no API key and permits up to 30 requests per minute per IP. It can also return 503 when processing capacity is full. For 429, respect the Retry-After response header. Use a bounded retry delay for temporary capacity errors.

Failures return JSON with an error field. Check 400 for invalid options, 413 for an oversized request, and 415 or 422 for unsupported or invalid input. A 500 response indicates a processing failure. Repeated retries may not solve a bad template or renderer problem.

Submitted documents and images are processed for the response and are not retained as uploaded files. Use these examples in server-side scripts: browser calls from unrelated origins are restricted by the service's CORS policy.

Try the browser tool

Prefer a visual interface before writing a script?

Try the image to PDF converter →