API Depot/APIs/PDF Generation

PDF Generation

liveasync

Convert HTML or Markdown content to a PDF server-side using WeasyPrint. Supports custom CSS and handles tables, fonts, and page breaks.

POST /v1/pdf/generatePer document

Request

FieldTypeDescription
content*stringHTML or Markdown content to convert
format"html" | "markdown"Input format (default: "html")
cssstringAdditional CSS to apply (default: empty)

Job Result

The endpoint returns { job_id: integer } immediately. Poll GET /jobs/{job_id} until status: "completed" — the result below is in the result field.

FieldTypeDescription
urlstringDownload URL — GET /v1/pdf/{job_id} streams the PDF

Example

Request

{
  "content": "# Invoice #123\n\n| Item | Price |\n|------|-------|\n| Service | €100 |",
  "format": "markdown",
  "css": "body { font-family: Arial, sans-serif; }"
}

Completed job result

{
  "url": "/v1/pdf/7"
}

Notes

  • Async endpoint — WeasyPrint takes 1–5s for complex pages.
  • Markdown is converted to HTML via python-markdown before rendering.
  • Generated PDFs are stored for 24 hours.
  • Once completed, download the file at GET /api/v1/pdf/{job_id}.

Try it