0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions108

Overview

The node provides a versatile set of no-code utilities grouped under various resources, including PDF operations. Specifically, for the PDF - HTML to PDF operation, it converts HTML content or a URL pointing to HTML into a PDF document. This is useful in scenarios where you want to generate PDFs dynamically from web pages or raw HTML code, such as creating reports, invoices, or printable documents from HTML templates.

Practical examples:

  • Convert a marketing email's HTML content into a PDF for archiving.
  • Generate a PDF invoice from an HTML template URL.
  • Create a PDF snapshot of a webpage by providing its URL.

Properties

Name Meaning
Code Variables Allows defining multiple code variables (name/ID and value) that can be used within custom code functions in the node.
Get File as URL Boolean option to specify whether the resulting PDF should be returned as a downloadable URL instead of raw data.
URL or HTML Code Choose between providing a URL or raw HTML code as the source for PDF generation.
URL The URL of the webpage to convert to PDF (required if "URL" is selected as source).
HTML Code Raw HTML code to convert to PDF (required if "HTML" is selected as source).
Options Collection of PDF rendering options:
  PDF Format Paper format size (e.g., A0, A1, A2, ..., Letter, Legal, Tabloid). Defaults to Letter.
  Scale Scale factor for rendering the webpage, between 0.1 and 2. Defaults to 1.
  Landscape Boolean to specify if the PDF should be in landscape orientation.
  Print Background Graphics Boolean to include background graphics in the PDF printout.

Output

The node outputs JSON data representing the result of the PDF conversion. Depending on the "Get File as URL" property:

  • If false, the output contains the PDF file data typically encoded in a binary buffer or base64 string within the JSON.
  • If true, the output includes a URL pointing to the generated PDF file, which can be accessed or downloaded externally.

This allows flexible handling of the PDF either directly within workflows or via external links.

Dependencies

  • Requires an API key credential for authentication with the underlying service providing the PDF conversion functionality.
  • The node internally calls an external API endpoint corresponding to the resource and operation (pdf/html).
  • No additional environment variables are explicitly required beyond the API key credential.

Troubleshooting

  • Common issues:

    • Providing invalid or unreachable URLs when selecting URL as the HTML source will cause failures.
    • Supplying malformed or incomplete HTML code may result in incorrect or failed PDF generation.
    • Scale values outside the allowed range (0.1 to 2) might cause errors or unexpected output.
    • Forgetting to provide required properties based on the chosen source type (URL vs HTML) will trigger validation errors.
  • Error messages:

    • Errors related to authentication usually indicate missing or invalid API credentials.
    • Network errors suggest connectivity problems to the external PDF conversion service.
    • Validation errors point to missing or incorrectly formatted input parameters.

To resolve these, verify all inputs carefully, ensure valid credentials are configured, and confirm network access to the API endpoint.

Links and References

  • n8n Expressions Documentation — for using expressions in variable definitions.
  • General PDF format standards (e.g., ISO 216 for paper sizes like A4, Letter).
  • External API documentation (not included here) for the PDF conversion service used by this node.

Discussion