PDF generation is included with the app as a standard service task that can be added as a step in the process.
Previously, this functionality was not in a service task but was built into the general code for changing process steps. If your app was set up before version 8.9, you should disable the functionality running outside the process definition.
You do this by turning off “enablePdfGeneration” on all data types.
Benefits of migrating to a service task are:
- Ability to retry if PDF generation fails, without having to run a full process next again, which can have unintended side effects.
- Ability to create many PDFs based on one task, or combine many tasks into one PDF.
- In the future: Run PDF generation as a background job with automatic retries and better scaling.
You can use the workflow tab in Altinn Studio to add a PDF service task. There are two options:
Filename
It is optional to include <altinn:filenameTextResourceKey>. Here you can specify a text resource key that will be used as the filename, with language and variable support. If it is missing, the PDF will get the application name as the filename.
{
"id": "pdfFileName",
"value": "My filename {0}",
"variables": [
{
"key": "form",
"dataSource": "dataModel.MyField"
}
]
}
Testing
Fill out the form and proceed. When you reach the service task for PDF in the workflow, the PDF should be generated and automatically proceed to the next element in the BPMN process, for example the receipt.
Troubleshooting
If you get an error message that the service task failed during PDF generation, it can be helpful to open the form in the app and add the query param pdf=1. Then you will see the same content that the PDF should have contained, and possibly the same error messages in the frontend.