Gotenberg Simple PDF icon

Gotenberg Simple PDF

Convert URLs and HTML to PDF using Gotenberg API

Overview

This node converts web content into PDF documents using the Gotenberg API. It supports two main conversion modes:

  • URL → PDF: Converts a publicly accessible webpage URL into a PDF.
  • HTML → PDF: Converts raw HTML content (either as text or binary data) into a PDF.

This node is useful for automating the generation of PDFs from dynamic or static web content, such as reports, invoices, or documentation pages. For example, you can convert a marketing landing page URL to a PDF brochure or transform custom HTML email templates into printable PDFs.

Properties

Name Meaning
Modo Conversion type: either "URL → PDF" or "HTML → PDF".
URL The webpage URL to convert to PDF. Required if mode is "url".
Origem Do HTML Source of the HTML content when mode is "html": either "Texto" (raw text input) or "Binário" (binary data from previous node).
HTML (Texto) Raw HTML code as text to convert to PDF. Required if mode is "html" and source is "text".
Nome Do Arquivo Filename to assign to the HTML file when source is text (default "index.html").
Propriedade Binária Name of the binary property containing the HTML data when source is binary (e.g., "data", "file"). Required if mode is "html" and source is "binary".
Nome Do Arquivo (Binário) Filename to assign to the HTML file when source is binary (default "index.html").
Tamanho Da Página Page size for the PDF output. Options: A4, Letter, Legal.
Margem Superior Top margin of the PDF page (e.g., "10mm").
Margem Inferior Bottom margin of the PDF page (e.g., "10mm").
Margem Esquerda Left margin of the PDF page (e.g., "12mm").
Margem Direita Right margin of the PDF page (e.g., "12mm").
Paisagem (Landscape) Whether to use landscape orientation (true/false).
Imprimir Plano De Fundo Whether to print background graphics (true/false).
Preferir @Page CSS Whether to prefer CSS @page size over specified page size (true/false).
Escala Scale factor for rendering the PDF, between 0.1 and 2.0 (default 1).

Output

The node outputs one item per input with the following structure:

  • json:
    • success: boolean indicating if the conversion succeeded.
    • mode: the conversion mode used ("url" or "html").
  • binary:
    • data: the generated PDF file in binary format, named with a timestamped filename like gotenberg-<timestamp>.pdf.

The binary data contains the PDF document resulting from the conversion.

Dependencies

  • Requires an active connection to a Gotenberg API instance (self-hosted or cloud).
  • Needs credentials providing the base URL and optional headers for authenticating with the Gotenberg API.
  • Uses multipart/form-data requests to send URLs or HTML content to Gotenberg.
  • No other external dependencies beyond standard n8n helpers and the form-data package bundled internally.

Troubleshooting

  • Binary Property Not Found: If using HTML source as binary, ensure the specified binary property exists on the input item; otherwise, an error will be thrown.
  • HTTP Errors: Common HTTP errors from Gotenberg include:
    • 415 Unsupported Media Type: Usually caused by incorrect Content-Type headers or proxy interference. Ensure the request uses multipart/form-data and no conflicting headers are injected.
    • Other HTTP status codes will be reported with their message.
  • Invalid URL or HTML: Make sure the URL is reachable and valid, or that the HTML content is well-formed.
  • Credential Issues: Verify that the API base URL and authentication headers are correctly configured in the node credentials.

Links and References

Discussion