Gotenberg icon

Gotenberg

Convert documents to PDF using Gotenberg API

Overview

This node integrates with the Gotenberg API to convert documents into PDF format. Specifically, the "URL to PDF" operation converts a web page at a given URL into a PDF document. This is useful for automating the generation of PDFs from online content such as reports, invoices, or articles without manual downloading or printing.

Common scenarios include:

  • Archiving web pages as PDFs for offline access or record keeping.
  • Generating printable versions of dynamic web content.
  • Automating report generation workflows where source data is available via URLs.

For example, you can input a URL like https://example.com and receive a PDF snapshot of that page formatted according to your specified paper size and layout preferences.

Properties

Name Meaning
URL The web page URL to convert into a PDF document. Must be a valid URL string.
Paper Size Standard paper sizes for the PDF output. Options: A3, A4, A5, Custom, Legal, Letter, Tabloid.
Paper Width (Shown if Paper Size is Custom) Width of the paper in units such as inches (in), millimeters (mm), centimeters (cm), points (pt), pixels (px), or picas (pc).
Paper Height (Shown if Paper Size is Custom) Height of the paper in supported units.
Landscape Whether to use landscape orientation instead of portrait. Boolean value.
Advanced Options Collection of additional settings including:
- Flatten PDF: Remove form fields and annotations.
- Generate Tagged PDF: Create accessible tagged PDF.
- Margins: Top, Bottom, Left, Right margins in supported units.
- Metadata: JSON string to embed metadata like title and author.
- Omit Background: Hide default white background for transparency.
- Page Ranges: Specify which pages to print (e.g., "1-5, 8").
- PDF for Universal Access: Enable accessibility optimizations.
- PDF/A Format: Convert to archival PDF standards (None, PDF/A-1b, PDF/A-2b, PDF/A-3b).
- Prefer CSS Page Size: Use page size defined by CSS.
- Print Background: Include background graphics.
- Scale: Rendering scale factor between 0.1 and 2.
- Single Page: Render entire content on one page.
- Wait Delay: Seconds to wait before conversion (URL only).

Output

The node outputs binary PDF data representing the converted document. The output includes:

  • json object containing:

    • success: Boolean indicating if the operation succeeded.
    • operation: The operation performed ("urlToPdf").
    • filename: The name of the generated PDF file.
    • contentType: MIME type, typically application/pdf.
    • size: Size of the PDF in bytes.
    • url: The original URL converted (only for URL to PDF).
    • paperSize: The paper size used for the PDF.
  • binary data field named pdf containing the actual PDF file content.

If the result is a ZIP archive (not typical for URL to PDF), the binary field will be named zip with MIME type application/zip.

Dependencies

  • Requires connection to a Gotenberg server API endpoint, configured via credentials providing the base URL and authentication token.
  • The node uses HTTP POST requests with multipart/form-data encoding to send conversion parameters and receive PDF data.
  • No other external dependencies are required.

Troubleshooting

  • Invalid URL or unreachable web page: Ensure the URL is correct and accessible from the Gotenberg server.
  • Timeouts or delays: Use the "Wait Delay" property to allow the page to fully load before conversion.
  • Incorrect paper size or layout issues: Verify paper size and margin settings; use custom sizes if needed.
  • Authentication errors: Confirm that the API key credential for Gotenberg is correctly configured.
  • Malformed metadata JSON: Check that the metadata string is valid JSON.
  • Large or complex pages failing: Try reducing scale or simplifying the page content.

Common error messages usually relate to network connectivity, invalid parameters, or server-side processing failures. Reviewing the Gotenberg server logs can provide more insight.

Links and References

Discussion