Generating PDFs with the API

Render print-ready PDFs from templates with control over margins, DPI, color mode and page ranges.

Published ·Updated

Orshot generates high-quality PDFs from your Studio templates — perfect for certificates, invoices, reports, tickets, and print-ready materials. Set response.format to pdf and use pdfOptions to control output quality and formatting.

Quick Start#

To generate a PDF, set the response.format to "pdf" in your API request:

JavaScript
const response = await fetch("https://api.orshot.com/v1/studio/render", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer <YOUR_API_KEY>",
  },
  body: JSON.stringify({
    templateId: "<YOUR_TEMPLATE_ID>",
    modifications: {
      recipient_name: "Jane Smith",
      certificate_title: "Course Completion Certificate",
      date: "March 25, 2026",
    },
    response: {
      format: "pdf",
      type: "url",
    },
  }),
});

const data = await response.json();
console.log(data.data.content); // PDF URL

How It Works#

  1. Design a template in Orshot Studio — the same template can render as an image or PDF
  2. Call the API with response.format: "pdf" and any content overrides
  3. Receive your PDF as a hosted URL or as the raw PDF file

The same template that generates a PNG social post can generate a PDF document — just change the format.

API Request Structure#

FieldTypeRequiredDescription
templateIdstringYesYour Studio template ID
modificationsobjectNoContent overrides
response.formatstringYesSet to "pdf"
response.typestringNo"url" for a hosted link. "binary", "base64" or no type return the raw PDF file
response.scalenumberNoScale factor for output size
response.fileNamestringNoCustom filename (without extension)
response.includePagesarrayNoTemplate pages to include, for example [1, 3]
pdfOptionsobjectNoPDF-specific settings (title, margin, DPI, color mode, image compression)

PDF Options#

Use the pdfOptions object to fine-tune your PDF output:

JSON
{
  "templateId": "<YOUR_TEMPLATE_ID>",
  "modifications": {
    "title": "Quarterly Report"
  },
  "response": {
    "format": "pdf",
    "type": "url"
  },
  "pdfOptions": {
    "title": "Quarterly Report Q1 2026",
    "margin": "20px",
    "colorMode": "rgb"
  }
}
OptionTypeDefaultDescription
titlestringresponse.fileNameDocument Title metadata, shown in browser tabs and PDF readers
marginstring"0px"Margin around the PDF content, in whole pixels ("20px" or 20). Other units return a 400
dpinumber72Scales the PDF page by dpi / 72. Leave unset for paper sizes. Details
colorModestring"rgb"Color mode: "rgb" for screen, "cmyk" for print
outlineTextbooleanfalsetrue turns all text into vector outlines so the PDF has no fonts, for print shops that ask for it. Details
imageFormatstring"auto"Set to "jpeg" to compress embedded photos, often 80 to 90% smaller
imageQualitynumber85JPEG quality from 1 to 100, used with imageFormat: "jpeg"
maxImageDpinumber300Downsample ceiling for embedded images, 0 keeps source resolution

Response#

The response structure is the same as image generation:

JSON
{
  "data": {
    "content": "https://storage.orshot.com/cloud/w-1/renders/images/invoice-001-a1b2c3d4e5f.pdf",
    "type": "url",
    "format": "pdf",
    "responseTime": 1840.2
  }
}

responseTime is in milliseconds. A custom fileName gets a short unique suffix, so two renders never overwrite each other.

Common Use Cases#

Certificates#

JavaScript
const response = await fetch("https://api.orshot.com/v1/studio/render", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer <YOUR_API_KEY>",
  },
  body: JSON.stringify({
    templateId: "<CERTIFICATE_TEMPLATE>",
    modifications: {
      recipient: "Alex Johnson",
      course: "Advanced JavaScript",
      date: "March 25, 2026",
      certificate_id: "CERT-2026-001",
    },
    response: {
      format: "pdf",
      type: "url",
      fileName: "certificate-alex-johnson",
    },
  }),
});

Invoices#

JavaScript
await fetch("https://api.orshot.com/v1/studio/render", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer <YOUR_API_KEY>",
  },
  body: JSON.stringify({
    templateId: "<INVOICE_TEMPLATE>",
    modifications: {
      invoice_number: "INV-2026-0042",
      client_name: "Acme Corp",
      amount: "$2,450.00",
      due_date: "April 15, 2026",
      cta_button: "Pay Now",
      "cta_button.href": "https://pay.example.com/inv-0042",
    },
    response: {
      format: "pdf",
      type: "url",
    },
  }),
});

Event Tickets#

JavaScript
await fetch("https://api.orshot.com/v1/studio/render", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer <YOUR_API_KEY>",
  },
  body: JSON.stringify({
    templateId: "<TICKET_TEMPLATE>",
    modifications: {
      event_name: "Tech Conference 2026",
      attendee: "Sarah Chen",
      seat: "Row A, Seat 14",
      qr_code:
        "https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=TICKET-001",
    },
    response: {
      format: "pdf",
      type: "url",
    },
  }),
});

For print, design the canvas at the paper size and leave dpi unset. Use CMYK color mode:

JSON
{
  "response": {
    "format": "pdf",
    "type": "url"
  },
  "pdfOptions": {
    "colorMode": "cmyk",
    "margin": "0px"
  }
}

What's Next#

Was this page helpful?

Ready to automate?

Start rendering images, PDFs and videos from your templates in under 2 minutes. Free plan, no credit card.

Get your API key
  • Image, PDF and video generation via API
  • Visual editor with AI and smart layouts
  • Zapier, Make, MCP and 40+ integrations
  • White-label embed for your own app
  • 100 free credits a month, no credit card required