Ask AI
Skip to main content

Convert html to pdf

Function: Convert HTML to PDF

This action allows you to transform any HTML content into a PDF document. It's perfect for generating reports, invoices, or any document you need to save or share in a standardized, uneditable format.

Input

  • HTML: The complete HTML content (including <html>, <head>, and <body> tags) that you wish to convert into a PDF. This should be provided as a piece of text.
  • Output: (Optional) The name of the variable where the generated PDF file will be stored. If you don't specify a name, the PDF will be stored in a variable named PDF_FILE by default.

Output

  • Output: A FILE type variable containing the newly generated PDF document. This variable will hold the actual PDF file, which you can then use for further actions like saving to storage, attaching to an email, or making it available for download.

Execution Flow

Real-Life Examples

Example 1: Generating a Customer Invoice

Imagine you have an HTML template for an invoice that gets populated with customer and order details. You want to send this invoice as a PDF to your customers.

  • Inputs:
    • HTML: <html><head><title>Invoice</title></head><body><h1>Invoice #12345</h1><p>Customer: John Doe</p><p>Amount: $150.00</p></body></html> (This would typically come from a dynamic template or data merge)
    • Output: CustomerInvoicePDF
  • Result: A PDF file named CustomerInvoicePDF is created, containing the formatted invoice. You can then use another action to email this PDF to John Doe.

Example 2: Archiving a Dynamic Report

You've built a dashboard that generates daily sales reports in HTML. You want to save each day's report as a PDF for historical records.

  • Inputs:
    • HTML: <html><head><title>Daily Sales Report</title></head><body><h2>Sales for 2023-10-26</h2><p>Total Sales: $5,000</p><p>New Customers: 10</p></body></html> (This HTML would be generated by your report logic)
    • Output: DailySalesReport_20231026
  • Result: A PDF file named DailySalesReport_20231026 is generated, capturing the sales data for that specific day. This file can then be stored in your document management system.

Example 3: Creating a Downloadable Product Brochure

Your website displays product information using HTML. You want to offer a "Download Brochure" button that provides a PDF version of the product details.

  • Inputs:
    • HTML: <html><head><title>Product X Brochure</title></head><body><h3>Product X Features</h3><ul><li>Feature 1</li><li>Feature 2</li></ul><p>Price: $99</p></body></html> (This HTML would be the content of your product page)
    • Output: (Left blank, so it defaults to PDF_FILE)
  • Result: A PDF file named PDF_FILE is created, containing the product brochure. This file can then be linked to the "Download Brochure" button on your website.