0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions114

PDF → HTML to PDF

AI-generated

Overview

This node operation converts HTML content or a URL pointing to HTML content into a PDF document. It supports inputting either raw HTML code or a URL to a webpage, and allows customization of the PDF output such as paper format, scale, orientation (landscape or portrait), and whether to print background graphics. The output can be returned as a file buffer or as a URL to the generated PDF. This operation is useful for automating the creation of PDF documents from web content or HTML templates, for example generating reports, invoices, or printable documents from dynamic HTML sources.

Use Case Examples

  1. Convert a webpage URL to a PDF document for archiving or sharing.
  2. Generate a PDF from custom HTML code for creating formatted reports or invoices.
  3. Customize PDF output format and orientation for specific printing requirements.

Properties

Name Meaning
Code Variables Allows setting variables defined in the code editor to be used during the PDF generation process.
Get File as URL Boolean option to specify whether the generated PDF should be returned as a URL instead of a file buffer.
URL or HTML Code Select whether the source for the PDF conversion is a URL or raw HTML code.
URL The URL of the webpage to convert to PDF. Required if 'URL or HTML Code' is set to URL.
HTML Code The raw HTML code to convert to PDF. Required if 'URL or HTML Code' is set to HTML.
Options Additional PDF generation options such as paper format, scale, landscape mode, and whether to print background graphics.

Output

JSON

  • pdf - The generated PDF file content or URL depending on the 'Get File as URL' setting.

Dependencies

  • Requires an API key credential for the CodeKit API to perform the PDF conversion.

Troubleshooting

  • Ensure the HTML or URL provided is accessible and valid to avoid conversion errors.
  • If the PDF is not generated as expected, check the options for format, scale, and orientation for correctness.
  • If 'Get File as URL' is enabled, ensure the environment can access the returned URL.
  • Common errors may include network issues, invalid HTML, or API authentication failures. Verify API credentials and network connectivity.

Links

Discussion