Convert options

Main request payload for `POST /v1/convert`.

{
  "source": "<html>...</html>" | "https://example.com",
  "format": "A4" | "Letter" | "Legal" | "A3" | "A5",
  "orientation": "portrait" | "landscape",
  "margin": { "top": "10px", "right": "10px", "bottom": "10px", "left": "10px" },
  "header": { "source": "<div>Header</div>", "height": "20mm" },
  "footer": { "source": "<div>Footer</div>", "height": "20mm" },
  "watermark": { "source": "<div>Draft</div>", "offset_x": 0, "offset_y": 0, "rotate": 0, "opacity": 0.2 },
  "sandbox": false,
  "wait_for": "#ready",
  "javascript": true,
  "delay": 250,
  "viewport": { "width": 1280, "height": 720 },
  "custom_css": "body { font-family: Inter; }",
  "custom_js": "window.__ready = true;",
  "page_ranges": "1-3",
  "scale": 1.0,
  "print_background": true,
  "protection": {
    "author": "Acme Inc",
    "user_password": "viewer-pass",
    "owner_password": "owner-pass",
    "no_print": false,
    "no_copy": false,
    "no_modify": false
  },
  "webhook": "https://your-app.com/pdf-callback",
  "filename": "invoice.pdf",
  "encode": false
}

Async mode

Use `/v1/convert/async` for large rendering jobs, then poll `/v1/jobs/{job_id}`. If `webhook` is provided, API returns queued response and posts completion payload to your callback URL.

High-fidelity controls

  • custom_css injects runtime styles before rendering.
  • custom_js injects runtime JavaScript for dynamic pages.
  • page_ranges supports ranges like 1-3,5.
  • scale tunes PDF zoom from 0.1 to 2.0.
  • print_background toggles background color/image rendering.
  • protection adds PDF passwords and print/copy/modify restrictions.
  • webhook enables asynchronous callback delivery for convert completion.
  • filename controls the response filename in encoded mode.