PDF

Turn HTML or images into shareable PDFs with one request.

Send HTML, a public URL, or an array of image URLs and receive a rendered PDF plus a signed download link. Rendering runs in headless Chromium with safe defaults and S3 storage.

Endpoint

POST once, get a signed PDF URL and metadata.

POST /api/v1/pdf/convert
Base URL https://luntrex.com

Choose one input

  • html — raw HTML string (scripts are stripped).
  • html_url — publicly reachable URL; fetched then rendered.
  • images — array of image URLs (renders one per page).

Send exactly one of the above fields. For images you can also set options.image_fit to contain or cover.

Options

  • options.page_size — e.g. A4 (default) or Letter.
  • options.orientationportrait (default) or landscape.
  • options.margin — uniform margin (e.g. 10mm) or per-side margin_top, margin_right, margin_bottom, margin_left.
  • model — optional identifier (defaults to l-pdf-1) for usage logging.

cURL (HTML payload)

curl -X POST https://luntrex.com/api/v1/pdf/convert \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<!doctype html><h1>Hello PDF</h1>",
    "options": { "page_size": "A4", "margin": "10mm" },
    "model": "l-pdf-1"
  }'

Images → PDF

POST /api/v1/pdf/convert
{
  "images": [
    "https://example.com/invoice-page1.png",
    "https://example.com/invoice-page2.png"
  ],
  "options": {
    "page_size": "Letter",
    "orientation": "portrait",
    "image_fit": "contain",
    "margin": "8mm"
  }
}

Each image is placed on its own page. Use cover to fill or contain to preserve aspect.

URL fetch

{
  "html_url": "https://yourdomain.com/invoice/123",
  "options": { "page_size": "A4", "orientation": "portrait" }
}

The service fetches the URL, strips scripts, applies your options, and returns a PDF.

Response

{
  "status": "ok",
  "pdf_url": "https://cdn.luntrex.com/signed/pdfs/9c0e...pdf",
  "expires_at": "2025-11-18T12:00:00Z",
  "meta": {
    "page_size": "A4",
    "orientation": "portrait",
    "render_ms": 920
  }
}

pdf_url is a signed S3 link. If the storage driver doesn?t support signed URLs, a path is returned instead.

n8n quick start

  1. Add HTTP Request node → Method POST → URL https://luntrex.com/api/v1/pdf/convert.
  2. Headers: Authorization: Bearer <API_KEY>, Content-Type: application/json.
  3. Body → JSON: provide either html, html_url, or images plus an options object.
  4. Use the returned pdf_url in a subsequent HTTP node to download or email.

Behavior & safety

  • Headless Chromium via Browsershot with JS disabled; scripts and inline events are stripped.
  • External fetches honor a small allowlist to reduce SSRF risk.
  • PDFs are written to S3 under pdfs/ with private ACL; responses include a signed URL.

Errors

  • 400 ? sent multiple input types or unsupported margin format.
  • 401 ? missing/invalid API key.
  • 422 ? validation failed (e.g. empty HTML, invalid URL).
  • 5xx ? render error; retry or simplify content.
Back to top