0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions132

PDF → Convert HTML to PDF

AI-generated

Overview

This node provides a utility to convert HTML content into a PDF document. It supports two input modes: either by specifying a URL of a webpage or by providing raw HTML code directly. The node then processes this input and generates a PDF file from the HTML content.

Common scenarios where this node is beneficial include:

  • Automatically generating PDF reports or invoices from dynamic HTML templates.
  • Archiving web pages as PDFs for offline access or record keeping.
  • Creating printable documents from custom HTML content without manual conversion tools.

For example, you could use this node to convert a dynamically generated invoice webpage into a downloadable PDF file that can be emailed to customers.

Properties

Name Meaning
Source Type Choose between "URL" (convert a webpage) or "HTML Code" (convert provided HTML content).
HTML Content Raw HTML code to convert to PDF (used if Source Type is "HTML Code").
Website URL URL of the webpage to convert to PDF (used if Source Type is "URL").
Return as URL Boolean option to return the resulting PDF as a downloadable URL instead of raw binary data.
File Name Desired name for the output PDF file.

Output

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

  • If Return as URL is false, the output will contain the PDF file data in binary form suitable for further processing or saving.
  • If Return as URL is true, the output will provide a URL pointing to the downloadable PDF file.

The exact structure includes fields for the PDF content or the URL, along with metadata such as the filename.

Dependencies

  • Requires an API key credential for authentication with the external PDF conversion service.
  • The node sends a POST request to the /pdf/html endpoint of the configured API base URL.
  • No additional environment variables are explicitly required beyond the API key credential.

Troubleshooting

  • Invalid URL or unreachable webpage: If the URL provided is incorrect or the webpage cannot be accessed, the conversion will fail. Verify the URL is correct and publicly accessible.
  • Malformed HTML content: Providing invalid or incomplete HTML may cause errors or unexpected PDF output. Ensure the HTML is well-formed.
  • API authentication errors: Missing or invalid API credentials will prevent the node from working. Confirm the API key is correctly configured.
  • Large HTML content or complex pages: Very large or complex HTML inputs might time out or exceed service limits. Try simplifying the HTML or splitting content.
  • File naming issues: Avoid using special characters in the file name to prevent issues with file handling.

Links and References

Discussion