How to Create a PDF from HTML in Zapier Using APITemplate

TL;DR:

This guide shows you how to convert HTML to PDF using Zapier and APITemplate. You write your HTML, insert dynamic fields from your trigger app, and get a download ready PDF back, no coding required.

  • Add a Zapier trigger (Google Sheets, Airtable, Jotform, etc.)
  • Use the APITemplate action “Create PDF”
  • Pass your data to fill in the template
  • Upload the generated PDF to Google Drive

Creating contracts, invoices, and agreements by hand does not scale. As volume grows, manual PDF creation becomes a bottleneck. If you want to convert HTML to PDF using Zapier, APITemplate makes it simple. It connects to your data source, fills in your template, and returns a download URL you can use in subsequent steps.

This works well for invoices, service agreements, contracts, quotes, and order confirmations.

Besides template-based PDF generation (which this tutorial covers), APITemplate also offers an API to convert a website URL to PDF and an API to generate a PDF from custom HTML content. This gives you flexibility depending on whether you are working with reusable templates, live web pages, or raw HTML content.

Automate PDF Documents Without the Setup Pain
Generate documents using HTML, templates, or API.
✔ Auto-generate PDFs from HTML
✔ Works with API & no-code workflows
✔ No rendering issues
Start For Free View Docs

Step 1: Choose Your Template in APITemplate

Log in to APITemplate and go to the Manage Templates tab. Click the New PDF Template button, and from the list of starter templates, select Sample invoice Template 1. This is a ready-made invoice template with its own HTML, CSS, and sample JSON already built in.

Here is what the template looks like when previewed in the editor:

APITemplate.io HTML-to-PDF invoice template editor with live PDF preview for Zapier automation.

The template uses variables like {{invoice_number}}, {{bill_to_address_line_1}}, {{from_email}}, etc. as placeholders. When you send data through Zapier, these placeholders get replaced with your actual values.

Here is the template’s HTML for reference:

<div class="main">
  <div class="header">
    <div class="parent2">
      <div class="frame-1">
        <h3>BILL TO:</h3>
        <p>
          {{bill_to_address_line_1}}
          <br> {{bill_to_address_line_2}}
          <br> <b>Phone</b>: {{bill_to_phone}}
          <br> <b>Email</b>: {{bill_to_email}}
        </p>
      </div>
      <div class="frame">
        <h3>FROM:</h3>
        <p>
          {{from_address_line_1}}
          <br> {{from_address_line_2}}
          <br> <b>Phone</b>: {{from_phone}}
          <br> <b>Email</b>: {{from_email}}
        </p>
      </div>
    </div>

    <div class="parent3">
      <div class="date">
        <p><b>INVOICE NO:</b><br> {{invoice_number}}</p>
      </div>
      <div class="date">
        <p><b>DATE:</b><br> {{invoice_date}}</p>
      </div>
    </div>
  </div>

  <table>
    <thead>
      <tr>
        <th class="align-center">Description</th>
        <th class="align-center">Quantity</th>
        <th class="align-center">Price</th>
        <th class="align-center">Amount</th>
      </tr>
    </thead>
    <tbody>
      {% for item in items %}
      <tr>
        <td class="align-left">{{item.item_name}}</td>
        <td class="align-center">{{item.quantity}}</td>
        <td class="align-right">{{ "$%.2f" | format(item.unit_price) }}</td>
        <td class="align-right">{{ "$%.2f" | format(item.total) }}</td>
      </tr>
      {% endfor %}

      <tr style="border-top: 4px solid black;">
        <td></td>
        <td colspan="2" class="align-right"><strong>TOTAL AMOUNT:</strong></td>
        <td class="align-right"><strong>{{ "$%.2f" | format(items | sum(attribute='total')) }}</strong></td>
      </tr>
    </tbody>
  </table>
</div>

<footer>
  Thank you for your business! For any questions, contact {{footer_email}}
</footer>

You do not need to modify anything in the template editor. The HTML and CSS will be used as-is. If you want to customize the layout later, you can open the template and edit the HTML or CSS to match your needs.

Step 2: Set Up Your Trigger in Zapier

For this tutorial we use Google Sheets – New Spreadsheet Row as the trigger. You can swap this for Airtable, Jotform, Typeform, or any other trigger.

Create a Google Sheet with two tabs:

Tab 1: invoices

ColumnExample Value
invoice_numberINV-2026-1087
invoice_date30/05/2026
bill_to_address_line_148 Greenway Boulevard
bill_to_address_line_2Chicago IL 60614
bill_to_phone312-555-0192
bill_to_emailorders@example.com
from_address_line_1710 Commerce Street
from_address_line_2Austin TX 73301
from_phone512-555-0347
from_emailbilling@apitemplate.io
footer_emailbilling@apitemplate.io

Tab 2: line items

invoice_numberitem_namequantityunit_pricetotal
INV-2026-1087Website Redesign125002500
INV-2026-1087SEO Audit1800800

Each row in the line items tab represents one item on the invoice, linked by invoice_number. You can add as many items as you need per invoice.

In Zapier, create a new Zap, select Google Sheets as the trigger, choose New Spreadsheet Row, connect your account, select your invoices sheet, and test to pull in a sample row.

Zapier editor displaying a Google Sheets trigger for a new or updated spreadsheet row, used in an automation workflow to generate PDF documents from HTML with APITemplate.

Step 3: Look Up the Line Items

  1. Add a new step below your trigger.
  2. Search for Google Sheets and select the action Lookup Spreadsheet Rows.
  3. Select your spreadsheet and choose the line items tab.
  4. For Lookup Column, select invoice_number.
  5. For Lookup Value, map the invoice_number field from your trigger step.

This step finds all rows in the line items tab that match the current invoice number and returns them as output.

Google Sheets row lookup in Zapier for PDF generation

Step 4: Add the APITemplate Action and Map Your Data

  1. Add a new step below the lookup step.
  2. Search for APITemplate and select the action Create PDF.
  3. Connect your APITemplate account using your API key (found under the API Integration tab in your APITemplate dashboard).
  4. In the Template dropdown, select your template ID.
  5. For Payload Type, select Auto generate fields from your template’s sample data schema.

This automatically creates input fields based on your template’s sample JSON. You will see fields for invoice_number, invoice_date, bill_to_address_line_1, and so on, including the items array fields.

6. Map each flat field to the corresponding value from your Google Sheets trigger (Step 1).

7. Map the Data items fields to the matching values from the Lookup step (Step 3).

APITemplate PDF generation step configured in Zapier workflow

8. Click Continue and then Test step. A successful test returns a download_url, open it in your browser to verify the PDF.

PDF generated successfully in Zapier using APITemplate integration

Step 5: Upload the PDF to Google Drive

  1. Add a new step below the APITemplate action.
  2. Select Google Drive and choose the action Upload File.
  3. Configure:
    • Folder: Pick your destination folder (e.g., “Invoices”).
    • File: Select the Download Url from the APITemplate step. Zapier will download the PDF from that URL and upload it.
    • File Name: Map the invoice_number field from your Google Sheets trigger.
    • File Extension: Type .pdf.
  4. Test the step and confirm the PDF appears in your Google Drive folder.

Tip: If you do not see the Download Url field, test the APITemplate step first. Zapier needs a successful test to expose output fields.

Generated invoice PDF stored and viewed in Google Drive

Complete Workflow

  1. Trigger: New Spreadsheet Row (Google Sheets – invoices tab)
  2. Lookup: Lookup Spreadsheet Rows (Google Sheets – line items tab)
  3. Action: APITemplate: Create PDF
  4. Action: Google Drive: Upload File

Every new row automatically generates a PDF invoice and saves it to Drive.

You can also create invoices from html in APITemplate, Read full guide here.

Conclusion

With Zapier and APITemplate, any form submission or spreadsheet row can become a professionally formatted PDF automatically. Set up your template once, map your data fields, and let the automation handle the rest.

Ready to start? Sign up for APITemplate and build your first Zap today.

Resources

Table of Contents

Share:

Facebook
Twitter
Pinterest
LinkedIn

Other Blog Articles

Copyright © 2026 APITemplate.io