Skip to main content

Build pages

The page element defines settings that apply to the entire template. It defines the page size and margins, header and footer behavior, and default HTML styles that apply to all elements in the template unless you otherwise define them for specific elements. Page does not contain content elements that appear on invoices.

note

You can create more than one active version of an invoice template per locale, and use conditional expressions to determine which fields appear on a version of an invoice template. You can only use conditional expressions in templates that you create or that you copy from a marketplace-provided default template. You cannot add conditional expressions to marketplace default templates.

Prerequisites​

None.

Default template JSON sample​

In the Appdirect Template_EN_US default template, see lines 143-189.

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 .

JSON structure context for page​

Page exists at the same level as the three invoice sections, header, body, and footer.


{
"page": {},
"header": {},
"body": {},
"footer": {}
}

Page settings JSON schema​


{
"page": {
"pageStyle": {
"pageMargin": {
"top": "45px",
"right": "45px",
"bottom": "45px",
"left": "45px"
}
},
"properties": {
"format": "A4",
"height": "11in",
"width": "8.5in",
"displayHeaderOnFirstPage": false,
"displayFooterOnFirstPage": true
},
"elementStyles": [
{
"name": "p",
"style": {
"font-size": "9px"
}
}
]
}

Elements to build page section​

ElementTypeDescription
pageobjectRequired. Defines page properties.
pageStyleobjectRequired. Defines page default styles.
pageMarginobjectDefines PDF page margin widths.
topstringTop margin width in pixels, ems, millimeters, points, or inches.
Format: [0-9]+(px|em|mm|pt|in)
Valid values: Dimension.
Example: 45px
rightstringRight margin width in pixels, ems, millimeters, points, or inches.
Format: [0-9]+(px|em|mm|pt|in)
Valid values: Dimension.
Example: 45px
bottomstringBottom margin width in pixels, ems, millimeters, points, or inches.
Format: [0-9]+(px|em|mm|pt|in)
Valid values: Dimension.
Example: 45px
leftstringLeft margin width in pixels, ems, millimeters, points, or inches.
Format: [0-9]+(px|em|mm|pt|in)
Valid values: Dimension.
Example: 45px
propertiesobjectRequired. Define page dimensions, and header and footer behaviour. Optionally, add properties that define visibility.
formatstringRequired. Page dimensions defined by paper format name. When format is defined, it overrides height and width properties. When null, height and width properties override this property. A4 | Letter | null
A4 dimensions: 8.27 Γ— 11.69 inches.
Letter dimensions: 8.5 by 11 inches.
heightstringRequired. Page height dimension in pixels, ems, millimeters, points, or inches.
When format property is defined, it overrides this property. To define custom dimensions, populate this and the width property, and set the format property to null.
Format: [0-9]+(px|em|mm|pt|in)
Valid values: Dimension or null.
Example: 11in
widthstringRequired. Page width dimension in pixels, ems, millimeters, points, or inches.
When format property is defined, it overrides this property. To define custom dimensions, populate this and the width property, and define the format property as null.
Format: [0-9]+(px|em|mm|pt|in)
Valid values: Dimension or null.
Example: 11in
displayHeaderOnFirstPagebooleanRequired. When a first or default header is defined in the header (see Build headers) and this property is set to true, a header appears on the first page; when set to false, a header does not appear on first page.
Valid Values: true | false
displayFooterOnFirstPagebooleanRequired. When footer is defined in the footer component (see Build footers) and when this property is set to true, the footer appears on all pages; when set to false, the footer does not appear on any pages.
Valid Values: true | false
elementStylesarrayStyle settings that apply to all elements in the template. Styles otherwise defined override these defaults.
namestringHTML element name for which a style is defined.
Valid values: All HTML element names.
Examples:
a
p
table th
styleobjectDefines CSS styles for the named HTML element. Only relevant styles that the Invoice Builder can render appear in the user interface preview and the PDF.
Examples for "a":
"color": #474747"
"text-decoration": "none"

Examples for "p":
"font-size": "9px"
"font-family": "Arial"

Example for "table th":
"font-family": "Arial"

Was this page helpful?