Turning RichText/HTML into PDF
  • Updated on 09 May 2013
  • 2 minutes to read
  • Print
  • Dark
    Light

Turning RichText/HTML into PDF

  • Print
  • Dark
    Light

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.
2017-12-29_114817.png

The HTML to PDF step outputs a file of FileData type, which is read in by theCreate File step, which actually creates the file itself.
2018-01-23_155847.png

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. 
2017-12-22_114404-1.png

2017-12-22_114559-1.png

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 theInputs > HTML field; for example, C:ClaimHistory.html .)

  • In theInputs > 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 theInputs > 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 .

  • 2018-01-22_152756-2.png

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.
2018-01-23_155905.png

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 .

2018-01-23_155929.png

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.
2018-01-23_161234.png

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.

2018-01-23_162842.png

Run the flow, and then browse to the Decisions > Decisions Service Manager directory (which is where generated files are saved by default).
2018-01-23_162915.png

Open the customer history PDF file and notice it contains the content of the .HTML file.

9PDF-1.png

Was this article helpful?