Template Root Object
The root object defines the complete template configuration.Properties
| Property | Type | Required | Description |
|---|---|---|---|
DocumentType | string | Yes | Document type identifier (e.g., ticket_venta, invoice) |
Name | string | Yes | Descriptive template name |
Sections | array | Yes | Array of template sections |
GlobalStyles | object | No | Global styling configuration (optional) |
TemplateId | string | No | Unique template identifier (auto-generated) |
Example
Section Object
Sections are logical blocks that group elements and define rendering behavior.Properties
| Property | Type | Required | Description |
|---|---|---|---|
Name | string | Yes | Section identifier (e.g., “Header”, “Items”, “Footer”) |
Type | string | Yes | Section type: "Static", "Table", or "Repeated" |
DataSource | string | Conditional | Path to data collection (required for Table and Repeated types) |
Order | int | No | Print order (lower values print first) |
Align | string | No | Default alignment: "Left", "Center", "Right", or null |
Format | string | No | Default format for all elements in section, or null |
Elements | array | Yes | Array of template elements |
Section Types
Static
Sequential elements printed in order. No data binding at section level.Table
Columnar layout with headers. Iterates over data collection.Repeated
Iterates over simple value collections (e.g., string arrays).Element Object
Elements are individual components within sections.Common Properties
| Property | Type | Required | Description |
|---|---|---|---|
Type | string | Yes | Element type: "Text", "Line", "Barcode", "QR", "Image" |
Label | string | No | Static text prefix before the value |
Source | string | Conditional | Path to data property (e.g., "Sale.Total"). Use "." for current item in Repeated sections |
StaticValue | string | Conditional | Fixed value when Source is not used |
Align | string | No | Element alignment (overrides section alignment) |
Format | string | No | Text formatting (overrides section format) |
Order | int | No | Element order within section |
Table-Specific Properties
| Property | Type | Required | Description |
|---|---|---|---|
WidthPercentage | int | Yes | Column width as percentage of paper width |
HeaderLabel | string | No | Column header text |
HeaderAlign | string | No | Header alignment |
HeaderFormat | string | No | Header text formatting |
Element-Specific Properties
| Property | Type | Applies To | Description |
|---|---|---|---|
Height | int | Barcode, Image | Height in points (1-255) |
BarWidth | int | Barcode | Module width (1-5) |
Size | int | QR | QR module size (1-16, recommended: 3-4) |
Columns | int | Multiple types | Number of elements per row |
Properties | object | All | Additional custom properties |
Format String
TheFormat property accepts space-separated values that can be combined.
Font Types
FontA: Standard font (48 characters per line on 80mm paper)FontB: Condensed font (64 characters per line on 80mm paper)
Text Styles
Bold: Bold textUnderline: Underlined text
Sizes
Large: Double height textDoubleWidth: Double width textSize2,Size3,Size4,Size5,Size6,Size7,Size8: Proportional scaling (1-8x)
Format Examples
Alignment Values
"Left": Left-aligned text"Center": Center-aligned text"Right": Right-aligned textnull: Inherit from parent section or default
Data Source Paths
Data sources use dot notation to navigate object hierarchies:Complete Example
Best Practices
Organization
- Use descriptive
Namevalues for sections and maintain consistent naming - Set
Ordervalues with gaps (10, 20, 30) to allow inserting sections later - Group related elements in the same section
Data Binding
- Always validate that
DataSourcepaths exist in your data model - Use
StaticValuefor labels and fixed text - Use
Sourcefor dynamic data
Formatting
- Apply common formats at section level to reduce repetition
- Override at element level only when needed
- Test formatting on actual printer hardware as rendering may vary
Column Widths
- Ensure
WidthPercentagevalues in Table sections sum to 100% - Account for printer margins and character limits
- Test with maximum expected content length
See Also
Section Types
Detailed guide for Static, Table, and Repeated sections
Element Types
Complete reference for all element types