Documents
In the admin: Workflows › a Workflow › a step
Two steps render a PDF: from a PDF template saved in Templates, or from a design written into the step. Both return the PDF as base64 content, which you usually store with a Create file step and attach to an email.
| Step | Renders | Result, as {{step.data}} |
|---|---|---|
| Generate PDF from template | a saved PDF template, filled with data | { "mimeType": "application/pdf", "content": "<base64>" } |
| Generate PDF | a pdfme design in the step, filled with data | the same |
Generate PDF from template
| Field | |
|---|---|
| Template | Required. A PDF template from Templates |
| Data | A JSON object: a value for each of the template's placeholders, with {{…}} |
Rendering a template is reading it: the executor needs READ on that template, within their row filter, as when a user prints it. Otherwise the step fails with TEMPLATE_ACCESS_DENIED before the template is loaded. An administrator executor passes.
Order completed renders Acme's Work order template:
| Field | Value |
|---|---|
| Template | Work order |
| Data | {"number": "{{start.data.number}}", "description": "{{start.data.description}}", "resolution": "{{start.data.resolution}}", "signed_by": "{{start.data.signed_by}}"} |
Then a Create file stores {{pdf.data.content}} as WO-000123.pdf, and Send email attaches it. Editing the template in Templates changes the PDFs every workflow renders from then on, without publishing the workflow.
Generate PDF
| Field | |
|---|---|
| Design | Required. A pdfme design object (basePdf and schemas), the same shape a PDF template stores |
| Data | A JSON object: values for the design's placeholders. A value that isn't text is written as JSON |
Use it for a one-off layout that doesn't deserve a template. Anything reused belongs in Templates, where it can be edited without changing the workflow.
Returning a file to the App
When a page of the App runs a workflow through a Call variable, a result shaped as a file is opened by the App as a file:
{ "asset": "f3a9…", "filename": "WO-000123.pdf" }
or, without storing it, { "mimeType": "application/pdf", "content": "<base64>", "filename": "WO-000123.pdf" }. End the workflow with a Finish with result that returns one of them.
Prefer storing the PDF and returning its asset: base64 content travels through the run and, with a Detailed history, is kept in it.
Errors
| Code | When |
|---|---|
TEMPLATE_ACCESS_DENIED | the executor may not read the template |
TEMPLATE_NOT_FOUND | no template with that id |
TEMPLATE_WRONG_KIND | the template is an email template, not a PDF one |
Next steps
- PDF templates: designing the templates these steps render.
- Files: storing the PDF.