Peedief icon

Peedief

Generate PDFs from HTML or Peedief templates

HTML to PDF

AI-generated

Summary

Converts an HTML string into a PDF through the Peedief API (POST /pdf), returning the API response JSON and optionally downloading the PDF as n8n binary data.

Inputs

  • html (required) — Complete HTML document or fragment to render as PDF.
  • fileName — Optional output file name (e.g. invoice.pdf). Trimmed; omitted from the request when empty so Peedief generates one.
  • downloadPdf — If true, fetches the PDF from the returned downloadUrl and attaches it as binary data. Default false.
  • binaryPropertyName (required) — Shown when Download PDF is on. Binary property that receives the PDF (default 'data').
  • pdfOptions — Collection of rendering options: format (A3/A4/A5/Letter), width, height (custom paper size), landscape, printBackground, scale (0.1–2), margins top/right/bottom/left, and marginUnit (mm, cm, in, px). Margins are sent as strings such as '10mm'. Only options that are set are sent.

Output shape

One output item per input item. Its json is the Peedief API response, and it includes a binary property with the PDF when Download PDF is enabled.

The source code reads downloadUrl and fileName from the response, but the exact response fields aren't otherwise defined here. With Download PDF on, the node errors if the response has no downloadUrl. The binary file name is the response fileName, or '.pdf' if that is missing. The request authenticates with the Peedief API key credential. With Continue On Fail enabled, a failed item returns json {error: message} instead of stopping the run.

Examples

Example 1: Render an invoice built in an earlier node as an A4 PDF and pass it to an email node.

html = {{$json.invoiceHtml}}, fileName = invoice.pdf, Download PDF = true, Binary Property = data, PDF Options: Format A4.

Example 2: Get a hosted PDF link without downloading the file.

html set, Download PDF off; read the download URL from the output JSON.

Example 3: Generate a landscape Letter report with wider margins.

PDF Options: Format Letter, Landscape on, all four margins 20, Margin Unit mm.

Links

Discussion