Print Templates

Summary

The Certificate Printing feature uses a modified version of the same templating engine as the Template Attribute, augmented with some print-specific metadata that tells the PDF printing system how to format the page.

Note: because these templates use the Razor syntax, which technically allows for arbitrary code execution, creation and editing of Print Templates is presently restricted to System Administrator users only. 

See also: full documentation on the WorkflowTemplateRenderModel template model

Creating the Template

Just like Workflow Template Attributes, Print Templates use the WorkflowTemplateRenderModel object as their data model. 

As of 9.5, Certificate Printing deals exclusively with Member Role data, so the template will be restricted to accessing model.MemberRole. Even though the Behavior that populates the queue may be attached to a different entity such as a Learning Plan (application), only the Member Role attributes themselves are visible to the printing system.

For full documentation on the template object model, see full documentation on the WorkflowTemplateRenderModel template model.

PDF Parameters

Unlike Workflow Templates, Print Templates are designed to be printed on paper. They are rendered as HTML, then converted to PDF, and then finally sent to a printer.

To provide additional control over the rendering and page layout process, Print Templates support additional (optional) metadata that can be passed into the PDF generation system. These parameters can be used to control options such as page size and zoom level.

PDF Parameters should be specified as a JSON-formatted string containing one or more of these options. (All settings are optional and can be omitted. For additional documentation, see the WkHtmlToPdf docs)

SettingDescription
PageSizeDefaults to "A4" but supports many other options as well. (full list)
PageWidthInteger. Sets the width of the document. (Should not be used at the same time as PageSize)
PageHeightInteger. Sets the height of the document. (Should not be used at the same time as PageSize)
OrientationEither "Landscape" or "Portrait"
MarginInteger. Is used as the top, bottom, left, and right margin.
ZoomFloat. Defaults to "1".
Sample PDF Parameters
{
  "PageSize": "A4",
  "Margin": "10",
  "Orientation": "Landscape"
}