PDF Generator API icon

PDF Generator API

Generate PDFs, manage templates, convert HTML/URLs to PDF, and perform PDF operations like watermarking, encryption, and optimization

Overview

This node integrates with a PDF generation API to convert HTML content or public URLs into PDF documents. It supports two main conversion operations:

  • HTML to PDF: Converts raw HTML content (including CSS styling) into a PDF file.
  • URL to PDF: Converts the content of a publicly accessible URL into a PDF.

This node is useful in scenarios where you need to automate the creation of PDFs from dynamic web content or custom HTML templates without manually using desktop software. For example, generating invoices, reports, or brochures on the fly from HTML or web pages.

Properties

Name Meaning
Operation Choose between "HTML to PDF" (convert HTML content) or "URL to PDF" (convert a public URL).
HTML Content The HTML markup to convert into a PDF. Must be at least 10 characters long.
URL Publicly accessible URL to convert into a PDF. Must start with http:// or https://.
Filename Desired filename for the generated PDF (without .pdf extension). Only letters, numbers, dots, hyphens, and underscores allowed. Cannot be empty.
Additional Options Collection of optional settings:
- Paper Size: A0, A1, A2, A3, A4 (default), Legal, Letter, Tabloid
- Orientation: Portrait (default) or Landscape
- Output Format: Base64 JSON string (default) or Binary file

Output

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

  • json:

    • success: Boolean indicating if the operation succeeded.
    • filename: The generated PDF filename with .pdf extension.
    • format: Output format chosen (base64 or file).
    • If output is base64, the response includes the base64 encoded PDF string and related metadata.
    • If output is binary file, the PDF data is provided as binary under the specified filename key.
    • fileSize: Size of the generated PDF in bytes.
  • binary (only if output format is set to "File (Binary)"):

    • Contains the actual PDF file data ready for download or further processing.

Dependencies

  • Requires an API key credential for the connected PDF generation service.
  • The node makes authenticated HTTP requests to the external PDF Generator API endpoint.
  • No additional environment variables are required beyond the API credential configuration.

Troubleshooting

  • Missing or invalid filename: The node requires a non-empty filename containing only allowed characters. Ensure the filename meets these criteria.
  • Invalid HTML content: HTML must be at least 10 characters long; otherwise, the node throws an error.
  • Invalid URL: The URL must start with http:// or https://. Invalid URLs will cause errors.
  • API authentication errors: Ensure the API key credential is correctly configured and has access to the PDF generation service.
  • Output format issues: If choosing binary output, ensure downstream nodes can handle binary data.
  • Network or API errors: Check network connectivity and API service status if requests fail.

Links and References

Discussion