Generate PDF
The Generate PDF action turns content you write in its HTML editor into a PDF file. Later actions can attach the PDF to an email or Autotask entity, or create a temporary download link for it.
When to Use This Action
Use this action when:
- You want to turn form responses into a formatted document
- You need to generate a report, confirmation, invoice, or summary
- You need to combine text expressions and uploaded images in one PDF
Don't use this action to convert an existing PDF or other file format. It creates a new PDF from the content in HTML Template.
How It Works
Your template becomes a PDF
The action fills in the text expressions in HTML Template with actual values, then turns the HTML and CSS into a PDF named by Output Filename. The PDF belongs to the current automation run. Later steps select it by the variable you name in Store the results in Variable, for example to attach it to an email.
Page margins are fixed
Every page has a 0.75-inch margin on each side. You can set the page size in your CSS, such as @page { size: A4; }, but not the margins.
Only content from the automation appears
The PDF includes your HTML, CSS, and CSS backgrounds. It does not run JavaScript, and it does not load images or other content from web addresses or file paths. To include an image, upload it through a form or produce it in an earlier action, then insert it from the editor as described below.
Configuration
| Field | Description |
|---|---|
| HTML Template | Content for the PDF. Use the inline rich-text HTML editor to format text, insert tables, edit HTML, and insert available automation data or text expressions. |
| Output Filename | Filename for the generated file. Supports text expressions. Default: document.pdf. |
Insert a Table
Click Insert table in the HTML editor toolbar, then enter the number of rows and columns. The editor inserts the table at your cursor with visible borders, cell padding, and a full-page-width layout. You can edit each cell directly or switch to HTML view to customize the table styles. Tables support 1 to 20 rows and 1 to 20 columns.
Insert Automation Data and Images
In the editor, type {{ to search the data available to the current action. Select a property or text-expression helper to insert it at the cursor. For example, select email.from.address to insert {{email.from.address}}.
To insert an image, type {{, search for an available image file, and select it. The editor inserts the complete image element with the correct expression.
When writing HTML manually, place the artifact_data_uri helper in the image src attribute. Use three braces so the image data is inserted exactly as is:
HTML Example
<style>
@page { size: A4; }
body { font-family: sans-serif; }
img { max-width: 100%; }
</style>
<h1>Request from {{input.name}}</h1>
<p>{{input.description}}</p>
<img src="{{{artifact_data_uri input.photo}}}" alt="Submitted photo">
Returned Variables
Store the results in a variable to make this file available to later actions.
| Variable | Type | Description |
|---|---|---|
id | string | Unique file ID. |
name | string | The file's name in the automation, normally the results variable name. |
filename | string | Generated filename. |
content_type | string | Always application/pdf. |
size_bytes | integer | PDF size in bytes. |
sha256 | string | SHA-256 content hash. |
For a results variable named generatedPdf, reference the filename as {{custom.generatedPdf.filename}}. Select custom.generatedPdf in a later action's Files section to attach or share the PDF.
FAQs
Why does an external image not appear?
The action does not load images from web addresses or file paths. Upload the image through a form or produce it in an earlier action, then select it in the editor or pass it to artifact_data_uri.
How long does the PDF remain available?
The PDF remains available as long as the automation's history entry. Download links created with Generate Artifact Download Links cannot keep it longer.
Related Actions
- Generate Artifact Download Links: create temporary links for the PDF
- Send an Email: attach the PDF to an outgoing email
- File Uploads in Forms: collect images and other files for a PDF
artifact_data_uri: embed uploaded or generated files in HTML