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 directly 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 managing your own PDF rendering infrastructure. 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 PDF. Must be at least 10 characters long. Used only for HTML to PDF operation.
URL Publicly accessible URL to convert into PDF. Must start with http:// or https://. Used only for URL to PDF operation.
Filename Desired filename for the generated PDF (without the .pdf extension). Must contain only letters, numbers, dots, hyphens, and underscores. Required for all conversions.
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 the generated PDF in one of two formats depending on the selected output option:

  • Base64 (JSON): Outputs a JSON object containing:

    • success: Boolean indicating success.
    • filename: The PDF filename with .pdf extension.
    • format: Output format (base64).
    • Base64 encoded PDF content as returned by the API.
  • File (Binary): Outputs binary data suitable for download or attachment with:

    • success: Boolean indicating success.
    • filename: The PDF filename with .pdf extension.
    • format: Output format (file).
    • fileSize: Size of the PDF in bytes.
    • Binary property keyed by the filename containing the PDF file data with MIME type application/pdf.

Dependencies

  • Requires an API key credential for the PDF Generator API service.
  • The node makes HTTP requests to the PDF Generator API endpoint (default base URL: https://us1.pdfgeneratorapi.com/api/v4).
  • No additional environment variables are required beyond the API authentication setup.

Troubleshooting

  • Missing or invalid filename: The node requires a non-empty filename containing only allowed characters. Ensure the filename is set correctly to avoid errors.
  • Invalid HTML content: For HTML to PDF conversion, the HTML must be at least 10 characters long. Short or empty HTML will cause validation errors.
  • Invalid URL format: For URL to PDF conversion, the URL must start with http:// or https://. Invalid URLs will trigger errors.
  • API request failures: Network issues or invalid API credentials can cause request failures. Verify API key validity and network connectivity.
  • Output format mismatch: If selecting binary file output, ensure downstream nodes can handle binary data properly.

Common error messages include:

  • "Filename is required for conversion operations": Set a valid filename.
  • "HTML Content is required for HTML to PDF conversion" or "HTML Content must be at least 10 characters long": Provide valid HTML content.
  • "URL is required for URL to PDF conversion" or "Please enter a valid URL starting with http:// or https://": Provide a valid URL.

Links and References

Discussion