Skip to main content

Build page number components

To add page numbers to invoice templates, add pagination tokens to cell components in headers or footers. You can combine plain text and tokens to build the page number output. For example, Page 1 of 2, or 1/2. For more information, see Tokens.

Prerequisites​

Add page number components to cell components that are in row components that are in header or footer components.

For more information, see the following topics.

Default template JSON samples​

In the Appdirect Template_EN_US default template, see lines 9-21.

To download the default template

πŸ“ Note: If the AppDirect logo appears in the upper-left corner of the page, when Manage > Marketplace appears in this topic, click the grid icon > Switch to | Store, instead.

  1. Go to Manage > Marketplace > Settings > Invoice templates > Appdirect Template_EN_US | Gear icon | Download JSON.

Page number component JSON​

{
"type": "pageNumber",
"data": "",
"style": {},
"properties": {
"visible": <true | false>
}
}

Elements to populate page number components​

ElementTypeDescription
pageNumberobjectDefines the styles, behaviors, and content for page numbers.
typestringRequired. Defines the component type as page number.
pageNumber
datastringRequired. Text, one or more tokens, or both.
Token format: {{Token Name}}
Valid values: All text and pagination tokens:
{{Page Number}}
{{Total Pages}}
Examples: See the Data property examples section in this topic.
styleobjectRequired. Defines formatting for pagination.
Valid values: HTML element names and CSS styles for the named HTML element.
All HTML styles. Only relevant styles that the Invoice Builder can render appear in the user interface preview and the PDF.
propertiesobjectRequired. Define visibility.
visiblebooleanRequired. Defines whether component appears on invoices.
Valid values: true | false

Data property examples​

Data examplesJSONOutput example
Data (simple binding){{Page Number}}1
2
Text and data (compound binding)"Page {{Page Number}}"Page 1
Page 2
Text and data (compound binding)"{{Page Number}}/{{Total Pages}}"1/2
2/2
Text and data (compound binding)"{{Page Number}} of {{Total Pages}}"1 of 2
2 of 2
Text and data (compound binding)"Page {{Page Number}} of {{Total Pages}}"Page 1 of 2
Page 2 of 2

Was this page helpful?