Ways to use the app in a Switch flow

The creation of  PDF documents with callas pdfChip needs two things in general: a template and payload (the data that will be loaded into the template). Accordingly, the way the app can be setup corresponds to where this information comes from. There are two main ways this can be setup and these are described in this article.

2.1.The template flows through the Switch flow

In this case, the Switch flow generates or picks up an HTML template and sends it through the flow. At some point, this template meets the pdfChip app in the flow, which converts the template to a PDF file that then travels on through the workflow.

In the pdfChip app, use the “Type of input data” property to enable this scenario. Set the property to:

  • Plain HTML/SVG file, or,
  • Folder with index.html

No payload

If you’re simply trying to convert HTML or SVG to PDF and your template doesn’t require additional input data to determine how the template looks like, you’re done. The pdfChip app simply converts your (static) template to PDF which ends up in the output folder.

Dynamic template

If your template requires additional input data, you can specify the path of a JSON file which will be made available to your template during processing in pdfChip. To use this feature, you must set the “Import data from JSON” property to “Yes”. This enables two additional properties.

  • Path to JSON file: the full path to the JSON file containing the data you want to make available to your template. This usually is a file somewhere on the file system, but with a small Switch script expression could also be configured as the path to a dataset connected to the incoming HTML template.
  • Name: determines the name of the variable in which the content of your JSON file will be imported. This determines how you’re going to be able to use it inside of your template.

2.2.The data flows through the Switch flow

In this case, the Switch flows generates or picks up a JSON file and sends it through the flow. At some point, this JSON file meets the pdfChip app in the flow. The template is now fixed (the same for all files flowing through this app) and the incoming file is the payload. pdfChip uses both pieces of information to generate a PDF file that then travels on through the workflow.

In the pdfChip app, use the “Type of input data” property to enable this scenario. Set the property to:

  • JSON file

You now also have to specify two additional properties:

  • Name: determines the name of the variable in which the content of your JSON file will be imported. This determines how you’re going to be able to use it inside of your template.
  • Path to HTML file: the full path to the HTML file you want to use. Typically, this is a file somewhere on the file system. As this property supports variables and script expressions, a different template could be used for different jobs.