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.

What is built today: Status

From template and record to label

Four steps, the same whichever door the label goes through. The numbers in the drawing match the list.

Schematic of a template and a data record combined into one label Two boxes at the top: 1 a template in JSON or XML whose elements are bound to your data, and 2 a record, one row of your data, with fields and their values. Counters, masks and functions add values that change on every label. Both feed 3, the step that binds the data to the elements and lays the label out once, which produces 4 the finished label. The field names and values are illustrative and the bars are decorative. Template JSON or XML Text: ShipTo Barcode: Sscc Text: Ref elements bound to your data 1 Record one row of your data ShipTo: Example Logistics Sscc: 376104250021234569 Ref: PO-48213 + counters, masks, functions 2 Binding and layout each element takes its value from the data; the label is laid out once 3 Example Logistics Inc. (00) 376104250021234569 PO-48213 4
Schematic, not a real template. The field names and values are illustrative and the bars are decorative, not scannable.
  1. TemplateIts size and its elements, in JSON or XML.
  2. 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.
  3. Binding and layoutThe engine resolves the template against the record and lays the label out once, in physical units.
  4. 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.

How data gets into a label through each door
DoorHow data gets in
SDK packagesBind data from objects, a DataTable, CSV, JSON or XML, in your own process, with no server.
REST APIRender and export labels, and generate printer commands, from a template and your data.
Label editorUpload 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

Sources 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.