You are here:
PDF Creation
To enable the creation of a PDF report, define a PRINTV2 action in the Process contract using its attributes and child elements. For example, the process with PrintV2 Action in core contracts is Order::HeaderTabProcess.
Required Editions
| Available in Lightning Experience in Enterprise and Unlimited Editions that have Consumer Goods Cloud enabled. |
This table shows the attributes that are required when defining the PRINTV2 action.
| Attribute | Description | Pattern | Data Type |
|---|---|---|---|
| printId | ID of the print layout. | Binding | — |
| locale | Locale of the user that is passed to the printing engine. The page is printed in the same locale that the application user used while running the associated report in the application. Specify the 2-character string like "de" or "en" that you used while running the associated report in the application. | Binding | string |
You can include these additional attributes in the PRINTV2 action.
| Attribute | Description | Pattern | Data Type | Default Value |
|---|---|---|---|---|
| showShareButton | Specifies the visibility of the share button in the pdf viewer. | Binding | Boolean | true |
| watermark | Inserts watermark into the print layout. If a watermark isn’t needed in the current print, pass " " or blank. A fixed font size and style are used (size 120 and opacity 0.1) for the watermark string. If the watermark is longer than the diagonal length of the page, the start and end of the watermark are truncated. |
Binding | string | — |
| generateAndSave | Opens the preview page of the print layout. If true, the action doesn’t open the
print preview. Instead a PDF is written and the path is returned to the return
statement in the action. Depending on the encryption status of the device, the PDF is
written encrypted or unencrypted. In this case, always set the input parameter blobPKey. |
Binding | Boolean | false |
Use the Parameters child element in the PRINTV2 action of a Process contract to specify the data to be passed to the print engine.
| Attribute | Description |
|---|---|
| Parameters | Specifies the list of data to be passed to the print layout using input
(required) name and value. Make sure that the name of the input matches the name in
the DataDeclaration tag and the value type
matches the declared type in the DataDeclaration
tag of the print contract. If all DataDeclarations in the print contract aren’t matched with Input tags,
printing is aborted. The parameter names blobPKey
and blobTableName are reserved and can’t be used
for report layout DataDeclarations. |
Sample code
This is a sample snippet of a Process Action, which calls a PrintLayoutV2. All parameters are passed as bindings. In the Process contract, the PrintId declaration contains the ID of the PrintLayout. The boolean declaration called showShareButton controls the display settings of the Share option. The locale is passed from the User Settings. The data to be printed is part of the Elements PrintPreviewHeader and PrintPreviewData.
<Action name="PrintPreview_Standard" actionType="PRINTV2" printId="ProcessContext::PrintId" locale="ApplicationContext::user.languageSpoken"
showShareButton="ProcessContext::showShareButton" watermark="ProcessContext::watermark">
<Parameters>
<Input name="header" value="ProcessContext::PrintPreviewHeader" />
<Input name="data" value="ProcessContext::PrintPreviewData" />
</Parameters>
<TransitionTo action="ShowView" />
</Action>

