Turning RichText/HTML into PDF

Last Updated: 05/02/2018 Introduced in Version: 2.0

The HTML to PDF component in a flow can convert text to PDF format. When used in a flow, this step reads in an HTML or text file, then converts it to PDF. This step does not actually create the file; it works in conjunction with the Create File step.

 
The HTML to PDF component is found in the Toolbox, under Data > PDF.
 
 

Example

This example reads in an HTML file that contains customer information. A company wishes to capture this information in PDF format so it cannot be edited.
 
 
 
The HTML to PDF step outputs a file of FileData type, which is read in by the Create File step, which actually creates the file itself.

 
 
 
 
 
 
 
In a Designer Folder, create a new flow.
 
From the Flow Designer’s startup window, expand All Steps [Catalog] > Data > PDF. Select an HTML to PDF component and click Add to place it into the workspace. 
 
 
Click on the HTML to PDF step. From the Properties panel, set its configuration.
  • To retrieve HTML from a file, check the Get HTML From File checkbox at the top of the Properties panel, under Configuration. This enables browsing for the file in the Inputs > HTML field. (Otherwise an alternative is to type the path in the Inputs > HTML field; for example, C:ClaimHistory.html.)
  • In the Inputs > FileName field, select the appropriate mapping type and enter a name for the HTML file. For example, a mapping type of Constant and a constant value of CustomerInformation.
  • In the Inputs > HTML field, select the appropriate mapping type and specify the HTML file. For example, a mapping type of Constant and browse to a file CustomerInformation.html.
 
 
 
The Outputs section fields will be left as-is for this example.
 
Next, from the Toolbox, expand the Integration > File category, and drag and drop a Create File component to the workspace following the HTML to PDF step. Connect the Done path of the HTML to PDF step to the Create File step. Connect the Failed path of the HTML to PDF step to the End step.
 
 
Click on the Create File step. This example reads in data from a file upstream of this step; therefore, the variable will be selected as input. From the Properties panel, click on the Inputs > Data > Mapping Type drop down list and select Select Value.
 
Browse to PDF File.Contents and click OK.
 
 
 
 
Under Inputs > FileName, select Constant as the mapping type and enter a name for the PDF. If desired, include a path to where you want the file to be saved. By default, if no path is specified, the file will be saved to the DecisionsDecisions Service Manager directory.
 
 
Connect the Done path of the Create File step to the End step. This completes the flow.
Click the Debug Flow link at the top of the workspace.

Note that in Decisions version 4.0 and above, you’ll need to click on Debug Flow to access the Debugger.

 

 

 
Run the flow, and then browse to the Decisions > Decisions Service Manager directory (which is where generated files are saved by default).
 
Open the customer history PDF file and notice it contains the content of the .HTML file.
 
 9pdf
 

Additional Resources