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 public URLs into PDF documents. It is designed for scenarios where users need to programmatically generate PDFs from web pages without manually downloading or printing them. Typical use cases include archiving web content, generating reports from online dashboards, or creating printable versions of web pages.

For example, you can provide a URL like https://example.com and the node will produce a PDF file of that webpage, optionally specifying page size, orientation, and output format (base64 JSON or binary file).

Properties

Name Meaning
URL The public URL of the webpage to convert to PDF. Must start with http:// or https://.
Filename The desired filename for the generated PDF (without the .pdf extension). Allowed characters: letters, numbers, dots, hyphens, and underscores. Cannot be empty. Default is "document".
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) (default) or File (Binary)

Output

The node outputs an array of items, each representing one conversion result. Each item contains:

  • json:

    • success: Boolean indicating if the conversion succeeded.
    • filename: The filename of the generated PDF including .pdf extension.
    • format: The output format chosen (base64 or file).
    • If output is base64 JSON, the response includes the base64 string data representing the PDF.
    • If output is binary file, the PDF file data is available in the binary property keyed by the filename.
    • fileSize: Size of the generated PDF in bytes.
  • binary (only if output format is File (Binary)):

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

Dependencies

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

Troubleshooting

  • Invalid URL error: If the URL does not start with http:// or https://, the node throws an error prompting to enter a valid URL.
  • Filename validation errors: Filenames must not be empty and can only contain letters, numbers, dots, hyphens, and underscores.
  • API request failures: Network issues or invalid API credentials will cause request errors. Ensure the API key is correctly configured and has necessary permissions.
  • Empty or too short HTML content (for HTML to PDF operation): Not applicable here but relevant if switching operations.
  • Unsupported operation/resource combination: The node throws an error if an unsupported operation is requested for the selected resource.
  • To handle errors gracefully, enable "Continue On Fail" in the node settings to process subsequent items even if some fail.

Links and References

Discussion