Gotenberg icon

Gotenberg

Convert documents to PDF using Gotenberg API

Overview

This node integrates with the Gotenberg API to convert and manipulate PDF documents. Specifically, the "Split PDF" operation allows users to split a single PDF file into multiple files based on specified page intervals or explicit page ranges. This is useful when you need to extract certain pages from a large PDF or divide a document into smaller parts for easier distribution or processing.

Practical examples:

  • Splitting a 100-page report into separate chapters by specifying page ranges.
  • Extracting every 5 pages from a large PDF to create smaller segments.
  • Combining selected pages into a single PDF file or keeping them as separate files.

Properties

Name Meaning
PDF File The binary field name containing the PDF file to split.
Split Mode Method of splitting:
- Intervals: split by fixed page intervals (e.g., every 2 pages).
- Pages: split by specific page ranges (e.g., "1-3,5-7").
Split Span Specification of how to split:
- For intervals: a number indicating the interval size.
- For pages: comma-separated page ranges or individual pages.
Unify Split Pages (Only for "Pages" mode) Whether to combine extracted pages into a single PDF file or output separate files for each range.
Advanced Options Additional settings affecting the output PDF:
- Flatten PDF: remove form fields and annotations.
- Metadata (JSON): metadata to embed in the PDF.
- PDF/A format options for archiving.
- PDF for Universal Access (accessibility).

Output

The node outputs an array of items where each item contains:

  • json: An object with details about the operation result including:

    • success: Boolean indicating if the operation succeeded.
    • operation: The performed operation ("splitPdf").
    • filename: The name of the resulting file.
    • contentType: MIME type of the output file (application/pdf or application/zip).
    • size: Size in bytes of the output file.
    • splitMode: The split mode used ("intervals" or "pages").
    • splitSpan: The split span specification string.
  • binary: Contains the actual PDF or ZIP file data under a key named either pdf (for single PDF output) or zip (if multiple files are zipped).

If multiple split files are generated, they are returned as a ZIP archive.

Dependencies

  • Requires access to a Gotenberg API endpoint (base URL must be configured in credentials).
  • Needs an API authentication token or key credential to authorize requests to the Gotenberg service.
  • The node uses HTTP POST requests with multipart/form-data encoding to send PDF data and parameters to the Gotenberg API.

Troubleshooting

  • Common issues:

    • Incorrect binary field name for the input PDF file will cause failure to read the source PDF.
    • Invalid split span format (e.g., malformed page ranges) may cause errors or unexpected results.
    • Network or authentication errors connecting to the Gotenberg API.
    • Large PDFs might cause timeouts or memory issues depending on the environment.
  • Error messages:

    • Errors related to missing or invalid input PDF file: Check that the binary property name matches the input data.
    • API request failures: Verify the base URL and API credentials are correctly set.
    • Parsing errors for split spans: Ensure the split span string follows the expected format (e.g., "1-3,5-7" or a positive integer for intervals).

Links and References

Discussion