Templates and data
Templates and data: one label design, many labels
A template describes a label once: its size and its elements. Data fills it. This page says what a template is, which formats and data sources BarcoderX reads, how a record binds to an element and where counters, masks and functions come in.
From template and record to label
Four steps, the same whichever door the label goes through. The numbers in the drawing match the list.
- TemplateIts size and its elements, in JSON or XML.
- RecordOne row of your data, from objects, a DataTable, CSV, JSON or XML. Counters, masks and functions add the values that change on every label.
- Binding and layoutThe engine resolves the template against the record and lays the label out once, in physical units.
- The labelThat one layout is what the preview, the exports and the printer commands all read.
What a template is
A template describes the label: its size and its elements. There are ten element kinds: text, barcode, picture, line, box, ellipse, grid, repeater, RFID and raw command. Sizes use physical units, millimeters, inches or dots, at any resolution from 96 to 1,200 dpi.
- JSON
- The canonical template format.
- XML
- A projection of the same template.
- In C#
- You can also build the label in code, in an application that targets .NET 10, instead of loading a template.
- Schemas
- Every released schema version keeps loading in every later build. The template layer ships schema migrations, a JSON Schema and an XSD.
- Output
- Deterministic: the same input gives the same bytes on every supported platform.
Data sources
Data comes from objects, a DataTable, CSV, JSON or XML. How it gets in depends on the door you use.
| Door | How data gets in |
|---|---|
| SDK packages | Bind data from objects, a DataTable, CSV, JSON or XML, in your own process, with no server. |
| REST API | Render and export labels, and generate printer commands, from a template and your data. |
| Label editor | Upload a sample, infer its schema and step through the records. Drag fields from a data tree onto the canvas to bind them. |
How data binds to a template
You bind your data to the elements of a template, and the engine resolves the template against that data and lays the label out once. In the editor you bind by dragging a field from the data tree onto the canvas.
For GS1 barcodes you enter the data in brackets or with FNC1, and the check digit is computed, validated or omitted, as you choose. GS1 and symbol options
Many labels at once come out as one multi-page PDF or as a ZIP of files. The same layout feeds the preview, the exports and the printer commands. How it works: one layout
Where expressions and functions come in
Some values change on every label instead of coming straight from a field. Counters, masks, variables and more than 100 built-in functions produce them. On manufacturing labels, asset tags and mining sample tags, the value that changes on every label is a serial or sample number from your own system.
Expressions combine fields and functions. The expression editor completes field and function names and flags errors as you type, and expressions run with hard limits.
The packages, the API and the editor all run one engine, so a template gives the same label whichever door it goes through. Data and expressions in the editor The packages
Where templates live
- In your code
- A template is a JSON or XML file you load, or a label you build in C#.
- On the API server
- Templates are stored with drafts, immutable versions and safe concurrent edits.
- In the editor
- A template list with search, versions, restore and publish, and import and export as JSON or XML.
Everything runs in your own environment: templates, data and print jobs stay on infrastructure you operate. The REST API The label editor
Keep reading
How it works: from template to printed label The platform: packages, API, editor and agent For developers The label editor Use cases Fonts and accentsSources Everything this page says about BarcoderX comes from its published platform, editor, developers and barcodes pages, and from the how it works page that restates them.
Written by BarcoderX in its own words.