Generate PDF
The Generate PDF action turns content from the inline rich-text 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
The action takes the content of HTML Template, fills in any text expressions with actual values, and turns the resulting HTML and CSS into a PDF file named by Output Filename. Every page gets a fixed 0.75-inch margin on each side. The PDF stays with the current automation run, and the variable you name in Store the results in Variable holds a reference to the file so later steps can attach or share it.
The PDF includes CSS backgrounds. For security, it disables JavaScript and does not load external HTTP URLs, HTTPS URLs, or local file references.
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 artifact, 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">
The action always uses 0.75-inch margins. You can set the page size in your HTML, but the action controls the page margins.
Security Restrictions
The action accepts the HTML and CSS in the editor, but it does not run JavaScript or load content from external HTTP URLs, HTTPS URLs, or local file paths. Upload images through a form or create them in an earlier action, then insert their image artifacts in the editor or use artifact_data_uri manually.
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 | Logical file name. This normally matches the configured 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 external URLs or local file paths. Upload the image through a form or produce it in an earlier action, then select its image artifact in the editor or pass its file reference to artifact_data_uri.
How long does the PDF remain available?
The PDF remains available for the lifetime of its automation history. Actions can use it during that run, and temporary download links cannot extend its retention.
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