Generating PDF output documents from a process

Learn to generate PDF documents from a process

Last published at: May 8th, 2024

A process may use many forms to collect data from users and perform approvals; at the end of the process, the collected data may be used to create an output document. 

To achieve this, let's use the “generateOutputDoc” step in the process definition. 

Let’s use the form definition “TestFormFile,” which looks as follows:

 

Let’s use the process definition “TestFormFileDef,” which looks as follows:

 

Let's drag the “generateOutputDoc” step to the designer and connect to the last step of the process. The red alert sign indicates the step property configuration is incomplete. The context is to create a new form, submit with some values, move the data from the earlier form to a new form instance, and then print a PDF document within the process.

 

Add a new variable, varOutputFile, to store the PDF file path. 

 

Click on the “generateOutputDoc” step to configure the Settings properties. Provide the variable reference to store the output PDF file path. Click on the button to define the document content, and a popup window will be displayed for configuration. Click on the Variable(s) button to view the list of system and process variables available for use. Likewise, you may use the Global(s) if they are defined in the process. Use the rich text area to determine the document content and select the variables from the drop-down list to merge with the content, as shown below. You may format the content using the tools provided in the rich text area, and the output document in PDF contains the same.   

 

The document content in the rich text area looks as follows in this example. 

 

Save the changes to the step and the process definition.   

 

Let’s generate and execute a new process instance. 

 

Then, you have to navigate to the Engage—Tasks page, as shown below. Select the Instances search filter and select the process instance from the drop-down list. The incomplete task assigned to the user is shown below. You may also search for the task using the Search textbox. Click on the task to open.

 

When the form fill-up is complete, submit it. Note: The Comments textbox is left empty as it's read-only, and this field value is set within the process using the “setFormFieldValues” step. 

 

The following is the executed path for the process instance. To let you know, the process instance is complete. Click on the “Create Output Doc” step to view the step properties below. 

 

The “Create Output Doc” step properties are displayed on a new page. The output PDF file path information is in the variable reference below.  

 

Use the AppURI and the variable output file path value to view the document content on the web browser.