Docs / URL to PDF

Rendering

URL to PDF

Pass a url and DevilPDF opens the page in Chrome and captures it.

curl https://devilpdf.com/v1/render \
  -H "Authorization: Bearer $DEVILPDF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com/reports/2026-q1", "options": { "page_size": "A4" } }'

#How the page is loaded

  • The URL must be public and use http or https. Local and private addresses are rejected.
  • JavaScript runs. Capture starts when the network goes quiet, so single-page apps render fully.
  • A page that never goes quiet (long polling, streaming analytics) is captured once it has finished loading.
  • If the page responds with HTTP 400 or higher, the render fails with render_error and the status code in the message.
  • The page has 45 seconds in total. After that the render fails with render_timeout.

#Wait for content

If the page loads data after it appears idle, tell DevilPDF what to wait for.

{
  "url": "https://example.com/dashboard",
  "options": { "wait_for": "#charts.loaded", "delay": 500 }
}

wait_for is a CSS selector. delay adds a fixed pause in milliseconds, up to 10000.

#Screen or print styles

URL captures use the page's screen styles by default, so the PDF looks like the page does in a browser. To use the page's print stylesheet instead, set options.media to "print".

#Page setup

page_size, orientation, margin, scale and page_ranges work as described in the render reference. header_text, footer_text and page_numbers print in the page margins.

{
  "url": "https://example.com/terms",
  "options": {
    "page_size": "Letter",
    "margin": "20mm 15mm",
    "footer_text": "example.com/terms",
    "page_numbers": true
  }
}

#Screenshots

Set format to png, jpeg or webp to get an image instead. The viewport defaults to 1280 by 800 and the full page is captured. See images.

{ "url": "https://example.com", "format": "png", "options": { "width": 1440, "full_page": false } }

#Pages behind a login

DevilPDF loads the URL as an anonymous visitor. It cannot send cookies or custom headers. For private pages, either render the HTML yourself and send it as html, or put a short-lived signed token in the URL.