RIDING BYTES
← All insights

November 21, 2026 · 5 min read

Sample stickers in SENAITE: how the template system works

Which settings decide the sticker that comes out of the printer, how the templates are built, how to add your own, and what to test on the real label printer before go-live.

Sample stickers in SENAITE: how the template system works

Every container that enters the lab needs a label that links it to its record in SENAITE. The label has to scan reliably, survive the fridge or the freezer, and still be readable by someone whose scanner just failed. SENAITE handles this with sticker templates: small HTML files with matching CSS, one per label format, that render a barcode and a few fields for each selected item and turn the result into a PDF for printing.

Printing a sticker

Stickers can be printed for a sample in any state. In the samples listing, select one or more samples and click Print stickers; in a sample, use the barcode icons to the right of the sample ID. Both open a print preview with two controls: the template and the number of copies. Print builds a PDF of the stickers and opens it in a new tab, and from there it goes through the operating system’s print dialog to the label printer.

That last step is outside SENAITE. Scaling, margins and the label size are printer driver settings, and they are the most common reason a sticker that looks right on screen comes out shifted or shrunk.

The same preview exists for worksheets, batches and reference samples, each with its own set of templates.

Sticker preview for sample DW-0002: template selector set to Code 128 1x48mm, number of copies 1, Back and Print buttons, a millimetre ruler and the label with barcode, DW-0002, 2026-07-22 and a third line cut off at the label edge.
The preview at true scale. On this small template the third line no longer fits, which is exactly what a test print should catch.

Which template is offered

For samples, three places in the configuration decide what the preview offers and preselects.

The setup, tab Sticker:

  • Automatic Sticker Printing: Register opens the print preview right after new samples are created, Receive after samples are received, None switches it off.
  • Default Sticker Template: the template used for automatic printing.
  • Small Sticker Template and Large Sticker Template: the fallbacks for the two sizes.
  • Default Number of Copies: how many stickers per sample.

One combination trips labs up: with Auto-receive samples switched on, new samples are received the moment they are created, and the add form then prints only if the option is set to Receive. With Register, nothing happens.

The sample type: Admitted sticker templates lists the templates allowed for samples of this type, and which of them is the small and the large default. A tube rack for serum and a 5-litre canister for wastewater rarely share a label size, so this is where the per-type choice belongs.

The template files themselves, which define the layout.

A detail worth knowing: if a sample type has no admitted templates at all, the preview falls back to offering every sample template on the system. Setting the admitted list keeps clerks from picking a 72 mm label for a 2 ml tube.

The templates that ship

Core ships these sample templates, named by symbology and size:

Code_128_1x48mm    Code_39_1x54mm     Code_93_2x38mm
Code_128_1x72mm    Code_39_1x72mm     QR_1x14mmx39mm
Code_39_40x20mm    Code_39_2ix1i      DIN_Address_40x85mm

Subfolders hold the templates for other content types: worksheet/, batch/ and referencesample/, each with a Code_39_40x20mm template.

A template is a page template that receives the item to label. The small Code 128 template, for example, prints the barcode, the sample ID in bold, the date sampled, the sample type and, for samples whose sample type is marked hazardous, a hazard icon. The barcode itself is a placeholder element:

<div class="barcode"
     data-code="code128"
     data-id="DW-0042"
     data-barHeight="12"
     data-showHRI="false"></div>

data-code names the symbology and data-id the value; a script in the preview turns it into the barcode image. The QR template works the same way and encodes the sample ID, not a URL, so a 2D scanner reads it like any barcode.

Adding your own template

Labs with their own label stock usually need their own template. An add-on registers a directory of stickers in its ZCML:

<plone:static
    directory="templates"
    type="stickers"
    name="mylab stickers" />

Every .pt file in that directory becomes a selectable template, with the .css file of the same name loaded alongside. A worksheet/ subdirectory in it holds worksheet templates, just like in core. After a restart, the new templates appear in the setup and in the admitted list of the sample type, where they still have to be selected.

The fastest route to a working template:

  1. Copy the core template closest to your label size.
  2. Change the fields in the .pt and the dimensions in the .css.
  3. Admit it on the sample types that should use it.
  4. Print it on the real printer before anyone relies on it.

Because it is HTML and CSS, the layout tools are the familiar ones. The constraint is the PDF renderer and the printer, not the browser, so test the printed result, not the preview.

What belongs on a sample sticker

  • The sample ID as barcode and as text. The text is for the moment the scanner does not read a frosted tube.
  • The client sample ID, if your clients send their own references. Mix-ups are often spotted on that number first.
  • The sample type or its short prefix.
  • The date sampled, which matters for holding times.

What usually does not fit: the full client name, which is too long for small labels, and the list of analyses, which changes after reception and makes the printed label outdated.

Scanning it back

Every barcode carries the sample ID, which is unique in the system. With a scanner configured as a keyboard, scanning into Spotlight (by default Ctrl+Space) finds the sample immediately, and Enter opens it.

The test that saves the first busy morning

Before go-live, print every template you plan to use on the actual label stock and the actual printer, then scan each label with the actual scanner. Barcode density, quiet zones and driver margins behave differently from printer to printer. A label that scans on the office laser printer and is cut off on the reception printer costs a morning to diagnose under pressure, and ten minutes to fix in the CSS beforehand.

Two people reviewing notes on paper next to a laptop

Bring this to your lab

Whether you are evaluating SENAITE, scaling it across sites, or wiring up instruments and monitoring, the team that wrote the platform is the team you talk to.