Skip to the page
Docs menu

Docs Sawlogs

Print tags

Print the QR tags that scale-with-tags measures with and count-tags counts. Generate a batch of tags, design the label, print to a Zebra printer or a PDF, and check the 62 mm size with a ruler.

Before step 2: Scan. For logs that carry QR tags. By the end, you will have a batch of tags, a ZPL file for a Zebra printer or a PDF, and a printed tag whose code you have measured at 62 mm.

A tag is a printed QR label stapled to a log end. Printing tags is not a capture mode: a tag is the log's identity in Count QR tags, and in Scale with QR tag it is also the ruler: the scanner knows the code's printed side, so a tag that prints at the wrong size makes every diameter wrong by the same proportion.

The payload#

Each tag holds a UUID, upper case, whose last five characters are the tag's short id. Only the short id is printed as text, large, so people can read a tag from a distance:

Text
7F3C9A12-5B0E-4D21-9C44-1A2B3C4A0001   payload, in the QR code
                                A0001   short id, printed on the tag
  • The payload is unique on its own (102 random bits), so two tags never collide, even with the same short id.
  • Short ids are five characters: the digits 0-9 and the letters A-Z except I, L and O, which read as 1 and 0. Lower case is accepted and upper-cased; I, L or O is refused (422 short_id_invalid) with the digit to use instead.
  • When a scan reads a tag, the payload becomes the log's tag.payload, exactly like any other tag. Tags you printed before keep working: the API takes any tag of 1 to 512 characters.

Create a batch#

A batch generates up to 1,000 tags. Short ids are sequential (a prefix of up to four characters and a counter: A0001, A0002, ...), random, or a list you give. A short id repeated within the batch is refused (422 short_id_duplicate); one already printed in your organisation is allowed and listed in warnings. Tags are free.

TypeScript
const batch = await timbereye.tagBatches.create(
    {
        name: "North yard, March",
        scheme: "sequential",
        prefix: "A",
        count: 200,
        labelTemplateId: "lbt_8fR2kQ",
    },
    { idempotencyKey: "tags-north-yard-march" },
)
curl
curl https://api.timbereye.com/v1/tag_batches \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
  -H "Idempotency-Key: tags-north-yard-march" \
  -H "Content-Type: application/json" \
  -d '{ "name": "North yard, March", "scheme": "sequential", "prefix": "A", "count": 200,
        "label_template_id": "lbt_8fR2kQ" }'
CLI
timbereye tags create --name "North yard, March" --prefix A --count 200 --template lbt_8fR2kQ \
  --idempotency-key tags-north-yard-march --json
JSON
{
    "id": "tgb_3mQ9vX",
    "object": "tag_batch",
    "name": "North yard, March",
    "scheme": "sequential",
    "count": 200,
    "first_short_id": "A0001",
    "last_short_id": "A0200",
    "warnings": [],
    "seen_count": 0
}

Abbreviated; every field is in the tag batch object. GET /tag_batches/{id}/tags lists the tags in print order with their payloads. Once a scan reads a tag, its item_id is the log; a tag printed but never read has item_id: null, and seen_count counts the tags that became logs.

Test and live keys#

Tags are physical labels, so batches and templates belong to your organisation, not to test or live mode. A test key and a live key list, read and print the same batches and templates, with the same ids, and the objects have no livemode. Print once, then try the tags in test mode and use them in live mode.

Logs are still test or live. item_id, group_id and seen_count come from the key's mode: a test key sees the logs its test scans made, a live key the logs its live scans made, never each other's.

Download the print file#

format=zpl gives ZPL II for a Zebra printer, at the template's resolution, one label per tag. format=pdf gives a PDF at the label's exact size, one label per page, or tiled on sheets with layout=a4 or layout=letter. The file is in the response: data is the ZPL text, or the PDF in base64.

TypeScript
import { writeFile } from "node:fs/promises"

const file = await timbereye.tagBatches.printFile("tgb_3mQ9vX", { format: "zpl" })
await writeFile(file.filename, file.data)
curl
curl "https://api.timbereye.com/v1/tag_batches/tgb_3mQ9vX/print_file?format=zpl" \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye tags download tgb_3mQ9vX --format zpl --out north-yard.zpl
JSON
{
    "object": "print_file",
    "format": "zpl",
    "filename": "north-yard-march-A0001-A0200-203dpi.zpl",
    "encoding": "utf8",
    "data": "^XA\n^CI28\n^PW813\n...",
    "label_count": 200,
    "qr": { "side_mm": 61.875, "target_side_mm": 62, "error_mm": -0.125, "printer_dpi": 203, "version": 4 }
}

Send the ZPL to the printer as it is (the console does this for you). For a PDF, set the print dialog to 100% or Actual size, never "Fit to page".

Design the label#

A label template sets everything around the code: the stock's width and height, margins, portrait (code above the text) or landscape (text beside the code), the Zebra printer's resolution (203, 300 or 600 dpi), the short id's size, up to four lines of text with {short_id}, {batch}, {species}, {length} and {custom}, and an optional logo (a PNG, printed black and white). The code itself is not a setting: it always prints at 62 mm, with a blank quiet zone of four modules on every side. A design that does not fit is refused with 422 label_too_small, saying what does not fit. The response gives the achieved size in qr and where everything goes in layout.

TypeScript
const template = await timbereye.labelTemplates.create({
    name: "Yard tags",
    stock: { widthMm: 101.6, heightMm: 152.4 },
    printerDpi: 203,
    shortId: { sizeMm: 16 },
    lines: [
        { text: "{batch}", sizeMm: 5 },
        { text: "{species} {length}", sizeMm: 5 },
    ],
})
curl
curl https://api.timbereye.com/v1/label_templates \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Yard tags", "stock": { "width_mm": 101.6, "height_mm": 152.4 }, "printer_dpi": 203,
        "short_id": { "size_mm": 16 },
        "lines": [{ "text": "{batch}", "size_mm": 5 }, { "text": "{species} {length}", "size_mm": 5 }] }'
CLI
timbereye tags templates create --name "Yard tags" --width-mm 101.6 --height-mm 152.4 --dpi 203 \
  --short-id-mm 16 --line "{batch}" --line "{species} {length}" --json
JSON
{
    "id": "lbt_8fR2kQ",
    "object": "label_template",
    "name": "Yard tags",
    "printer_dpi": 203,
    "qr": {
        "side_mm": 61.875,
        "target_side_mm": 62,
        "error_mm": -0.125,
        "module_dots": 15,
        "quiet_zone_mm": 7.5
    },
    "layout": { "warnings": [] }
}

With the code and its quiet zone the label must be at least about 77 mm in each direction (the quiet zone is 6.7 to 7.5 mm depending on the resolution). Choose stock that suits your yard's conditions; Timbereye makes no recommendation of material or printer model.

In the console, Data > Tags lists your batches. New batch asks how many tags and how to number them, and shows the first and last short id before you create them. The label designer draws the label to scale as you change it. From a batch you can Download ZPL, Download PDF, or Print to Zebra:

  • with Zebra Browser Print, Zebra's helper for the computer the printer is connected to, when it is running;
  • straight to a printer on USB or a serial port, in Chrome or Edge on a computer;
  • or by downloading the file, which always works.

Check the size with a ruler#

Print one test label first (Print one test label in the console, or timbereye tags templates test-label lbt_8fR2kQ --format zpl). It follows a label with a bar exactly 62 mm long.

  1. Measure the bar with a ruler: it should be 62 mm. If it is not, the printer's resolution is not the template's.
  2. Measure the code, from the outer edge of one corner square to the outer edge of the other: it should be between 61.5 and 62.5 mm. A Zebra prints whole dots, so the code is the closest whole-dot size, shown in qr.side_mm (61.9 mm at 203 and 600 dpi, 61.7 mm at 300 dpi).
  3. For a PDF, a code of about 60 mm or smaller usually means the print dialog scaled the page to fit.

Throw the test label away: its short id is TEST0 and it belongs to no batch.

What is produced#

  • ZPL II: the code as a graphic (^GFA) of whole dots per module, text in the printer's scalable font, one `^XA ...

^XZ` label per tag, the first label being the 62 mm bar. No other printer language.

  • PDF: pages at the exact physical size, the code as vector shapes, the "Actual size" reminder and the 62 mm bar.
  • Not: darkness, speed or media settings (the printer's own configuration), barcodes other than QR, or RFID.