Create Preview PDF

The Create Preview PDF plugin generates a PDF preview for a single record as fast as possible. This preview is typically used for previews embedded in web pages.

The plugin retrieves the resulting PDF from the file store and makes it available to the process as the job data file. The job file name extension is .pdf.
This file could be written to a publicly accessible location (for example the _iRes folder) so that the path could be served back to the browser, allowing the web page to embed the PDF data for online viewing.

To make the rendering process as fast as possible, the generated PDF isn't optimized for print production purposes.

Note: Content creation may be aborted by a script in a Connect template that raises a fatal error. This triggers the On Error tab of the Content Creation task. See Designer Script API.

Tip: Drag-and-drop a template from the Connect resources in the Configuration Components pane on a process to add this task or one of the other OL Connect tasks that create content from a template: a Create Email Content task, a Create Print Content task, or a Create Web Content task.

Properties

Datamapper tab

The Create Preview PDF plugin gets one record from the source selected on the Datamapper tab. This record is then merged with the template (selected on the Content Creation tab) to create a preview PDF.

The Datamapper tab can have one of the following source options:

  • Data mapping configuration sets the data source to a data mapping configuration.
    • %o: Select this to use a dynamic data mapping configuration name. Click on %o to change the expression that determines the name of the data mapping configuration to use.
    • Alternatively, select a configuration name. Adding configurations to this list is done through the Send to Workflow option in the Designer module.
      Click the Open data model of selected configuration button to view the data model attached to the chosen configuration in the DataMapper module, to verify that the right one is used.
    • No storing or post-processing of the data records (faster): This option prevents data from being written to the database. Instead, records are streamed directly into the Content Creation process for immediate merging. Turning this feature on can improve data mapping performance significantly, as well as the time required for the cleanup process. However, since the data is not written to the database, there is no way to do post-processing on the extracted data. Any post-processors defined in the data mapping configuration will be disabled.
      This option is unchecked by default.

      Note: When the data mapping configuration provides multiple records, the preview is created based on the first record.

  • Note: The Create Preview PDF plugin cannot pass runtime parameters to a data mapping configuration. Instead it uses the default values set up in the Preprocessor of the data mapping configuration.
    To work around this issue, insert an Execute Data Mapping task (which does allow to specify runtime parameters) immediately before the Create Preview PDF plugin; configure it to output JSON, and use the JSON string option in the Create Preview PDF plugin.
    Other possibilities are to use the All In One task, or to include the variables in the data file and let the data mapping configuration extract them.

  • JSON string sets the data source to a JSON string (see Working with JSON). A text area is shown allowing the user to enter the JSON string.
    The JSON string may contain local and global variables, Job Infos and data selections (see JSON string examples).
    A single variable can be used, assuming that the respective variable contains a JSON string.
    In case the JSON string is not a valid JSON object, the plugin will error out with an explicit message.

    Note: This option requires that keys in the JSON string have matching field names in the data model of the template. When they have, the JSON values are passed to the template and the personalization scripts of the template will have access to the values through the record's data fields. (See the Designer help: Adding Variable Data).

  • Metadata uses existing metadata, generally the output of a Create Record Set or a Retrieve Items task set to retrieve a record.
    Update fields with metadata: when this option is selected, the plugin will update fields in the Connect database based on the metadata content. This is only useful if the Workflow process has modified the metadata and the corresponding fields should be updated in the database before creating the preview PDF.

    Note: The Metadata option requires that entries in the metadata have matching field names in the data model of the template. When they have, the values are passed to the template and the personalization scripts of the template will have access to the values through the record's data fields. (See the Designer help: Adding Variable Data).

Content Creation tab

The Create Preview PDF plugin creates a preview PDF from a template selected on the Content Creation tab, using the record that results from the data source selected on the Datamapper tab. The record is then merged with the template to create a preview PDF.

Select the appropriate template or option:

  • %o: Select to use a dynamic template name. Click on %o to change the expression that determines the name of the template to use.
  • A template name: Select the appropriate template name from the list. Adding templates to this list is done from the Send to Workflow option in the Designer module.
    A preview will be displayed of the output generated by the Print context of the selected template. (Not available for a dynamic template name).

If on the Datamapper tab, the source has been set to Metadata or JSON, the following option is also available.

  • Runtime Parameters: The runtime parameters defined in the selected template are displayed and their values can be set here. (See Runtime parameters in the Online Help of OL Connect.)
    Right-click the field to open the contextual menu that allows to select variables, data and lookup functions (see Data selections).
    If the template name is dynamic, you must enter the name (or select a variable that contains the name) and set the value of all runtime parameters that may occur in the template.
    If a runtime parameter is defined in a template, but not set in the task properties, an error will be raised.

    Note that it is not possible to change a parameter's type here; that can only be set in the template itself.
    At runtime, Workflow passes the parameter values as strings, and the type defined in the template will be used to try and parse the input parameter value. In order to make this work:
    Boolean values need to be entered as a non-empty string (including, counter-intuitively, the string "false") for "true", or an empty string for "false", as dictated by the JavaScript truthy/falsy type system.
    Numeric string values need to be parseable as a number (either a whole integer or decimal value).
    Dates should be in an ISO8601 compatible format (e.g. 2019-10-15) or use the current Windows Locale date settings options. The latter is not recommended as it requires all computers in the cluster have the same locale data format.

    Note: Backslashes (\) and double quotes (") in a JSON string must be escaped with a backslash (\\, \") if the JSON string is passed via a global, local, or Job Info variable.
    If the JSON is entered directly in the runtime parameter field, the plugin adds the necessary backslashes.

Note: It is not currently possible to specify Runtime parameters on the Content Creation tab if, on the Datamapper tab, the source has been set to "Data mapping configuration". There is, however, an easy workaround: insert an Execute Data Mapping task immediately before the Create Preview PDF task, configure it to output either Metadata or JSON and adjust the settings on the Datamapper tab of the Create Preview PDF task accordingly. The Content Creation tab then allows to specify Runtime parameters for the selected template.

OL Connect Proxy Tab

  • Server Connect Settings
    • Connect Proxy Address: Enter the machine name or IP Address where the OL Connect Server resides.
    • Port: Enter the port to use to communicate with the OL Connect Server. Default: 9340.
    • User name: Enter the user name expected by the OL Connect Server.
    • Password: Enter the password expected by the OL Connect Server for the above user name.

On Error Tab

For a description of the options on the On Error tab see Using the On Error tab.

Miscellaneous Tab

The Miscellaneous tab is common to all tasks.

It contains a text area (Task comments) that lets you write comments about the task. These comments are saved when the dialog is closed with the OK button and are displayed in The Task Comments Pane.

Check the option Use as step description to display the text next to the icon of the plugin in the Process area.

The tab also provides an option to highlight the task in The Process area with the default color, set in the Preferences (see Colors), or the color selected or defined under Highlight color on this tab.
To revert the selected highlight color to the default color, open this tab, turn the Highlight option off and close the dialog with the OK button; then turn highlighting back on.
Highlighting can also be turned on and off via the task's contextual menu and with the Highlight button on the View ribbon.