You are here:
PrintLayout V2 Structure
You can easily create a contract by cloning a PrintLayout V2 contract and modifying it to suit your needs.
Required Editions
| Available in Lightning Experience in Enterprise and Unlimited Editions that have Consumer Goods Cloud enabled. |
When you create a PrintLayout V2 contract from scratch, understand what each part does.
The root node of the contract, PrintLayout, has a unique name attribute. The supported elements in PrintLayout are Declarations, DocumentProperties, and ReportLayout.
Declarations
Declarations specify the interface between the Process which calls the PDF Print and the PrintLayout contract. Use Declarations to declare:
- Data to be shown in the print layout. For example - specify a declaration for a business object in ReportLayouts.
- PNG and SVG images to be used in Reports.
DocumentProperties
Define the document properties of the generated PDF by using literal values or by referencing the data in the Declaration section.
ReportLayout
Define the overall look and feel of a report. The ReportLayout uses XHTML, so it’s easy to configure the desired look to the report.
- Customize the header, footer, page size, page layout, tables, heading levels, paragraph, and other properties that can be printed on the pages of a PDF document to match and align with your company branding.
- Use macros in XML attributes or as XML text nodes for more flexibility in the created output. You can chain multiple macros in a text node like in a paragraph, or add reference to labels and global labels.
The name attribute of a ReportLayout should match the
folder name. For example: If folderName is frameworkPrintoutV2, then the ReportLayout name is frameworkPrintoutV2.
You can extend the ReportLayout name by using _someSuffix to build custom adaptations of frameworkPrintoutV2.
Macros
Use macros to bind dynamic values to the print layout. Macros perform data lookup on the referenced contract types, and filter and replace the relevant values for attributes or nodes in the PrintLayout V2 contracts. The print engine supports the use of macros to bind the referenced data to the labels and the bindings.
- value (within each node)
- value (within the correlation node)
- text
- src (within the img node)

