Section Types Overview
APM templates support three section types, each designed for different layout patterns:- Static: Sequential elements for headers, footers, and totals
- Table: Columnar layout for line items and tabular data
- Repeated: Simple lists for repeating text or values
Section Properties
All sections share these common properties:| Property | Type | Required | Description |
|---|---|---|---|
Name | string | Yes | Unique section identifier |
Type | string | Yes | Section type: "Static", "Table", or "Repeated" |
DataSource | string | Conditional | Data collection path (required for Table and Repeated) |
Order | int | No | Print order (ascending, default based on array position) |
Align | string | No | Default alignment for all elements: "Left", "Center", "Right" |
Format | string | No | Default text format for all elements |
Elements | array | Yes | Array of template elements |
Inheritance
- Section-level
AlignandFormatare inherited by all elements - Elements can override section defaults with their own properties
- If section properties are
null, elements use template defaults
Static Sections
Static sections render elements sequentially in the order they appear. No data iteration occurs.Use Cases
- Document headers with store/company info
- Totals and summary information
- Static footer text
- Separator lines and spacers
Properties
- DataSource: Not used (ignored if present)
- Elements reference top-level data model properties
Example: Header Section
Example: Totals Section
Example: Barcode Section
Table Sections
Table sections render data collections in columnar format with optional headers.Use Cases
- Line items in sales receipts
- Product lists with prices
- Transaction details
- Any tabular data with multiple columns
Properties
- DataSource: Required - path to data collection (e.g.,
"Sale.Items") - Elements define columns with
WidthPercentage - Column widths should sum to 100%
Element Requirements
Each element in a Table section must specify:WidthPercentage: Column width as percentage of paper widthSource: Property name from each item in the collection- Optional
HeaderLabel: Column header text - Optional
HeaderAlign: Header alignment - Optional
HeaderFormat: Header formatting
Example: Sales Items Table
Example: Three-Column Layout
Table Rendering
When a Table section is rendered:- Headers are printed first (if
HeaderLabelis specified) - Each item in the
DataSourcecollection is iterated - For each item, columns are rendered side-by-side
- Text is truncated or wrapped based on
WidthPercentageand printer width
Repeated Sections
Repeated sections iterate over simple value collections (typically arrays of strings).Use Cases
- Footer messages or disclaimers
- Multiple lines of promotional text
- List of payment methods
- Terms and conditions lines
Properties
- DataSource: Required - path to simple value array (e.g.,
"Footer") - Elements typically use
Source: "."to reference current item
Special Source Value
In Repeated sections, use"." as the Source to reference the current item value directly:
Example: Footer Messages
Example: Multiple Elements per Item
Example: Formatted List
Section Ordering
TheOrder property controls the sequence in which sections print:
Best Practices
- Use increments of 10 (10, 20, 30) to allow inserting sections later
- Lower numbers print first
- If
Orderis omitted, sections print in array order
Section-Level Formatting
Apply common formatting at the section level to reduce repetition:- All elements inherit
Align: "Center"andFormat: "Bold" - The phone number overrides with empty format to remove bold
Complete Multi-Section Example
Common Patterns
Pattern: Header + Items + Totals
Pattern: Repeating Groups with Separator
Pattern: Centered Static Content
Troubleshooting
Table columns don’t align
- Verify
WidthPercentagevalues sum to 100% - Check for very long text that may overflow columns
- Test with actual printer to confirm character limits
Repeated section not printing
- Verify
DataSourcepath exists in data model - Ensure data is an array
- Check that
Source: "."is used for simple values
Section appears in wrong order
- Check
Orderproperty values - Ensure all sections have explicit
Ordervalues - Remember lower numbers print first
See Also
Template Structure
Complete JSON structure reference
Element Types
Text, Barcode, QR, Image, and Line elements