Elements
Barcode element
A Barcode element prints a QR code or barcode generated from a value: a payment link, an invoice number, a product code. The value can be fixed, the same in every document, or taken from a field in your data so each document carries its own code.
Weft draws the code itself, so it stays sharp at any size. For a code you were given as a picture file, use an Image element instead.
In the hosted app, changing a template needs the editor role or higher. Local mode has a single user and no roles.
Add one
- Open the Add block menu: press the + under the selected element or at the end of the document in Flow view, the + on the line that appears between two elements as you hover, or Add block at the top of the outline in the structure panel.
- Under Content, choose Barcode.
The new element is a QR Code encoding an example payment link. It goes where you pressed the +: just after the selected element (inside the same container), into the gap you hovered, or at the end of the document. The outline's Add block also puts it after the selected element, or at the end when nothing is selected. It can sit at the top level, or inside a section, a column, a grid cell, a repeat or a conditional — but not in a table's cells, which hold text only.
Properties
Select the barcode, then open the properties panel with the Show properties panel button at the far right of the app bar, or press ⌘. (Ctrl+. on Windows).
Barcode
Symbology is the kind of code, and each kind accepts different values:
| Symbology | What it can encode |
|---|---|
| QR Code | Any text, such as a web address, up to a maximum length |
| Data Matrix, Aztec, PDF417 | Any text, up to a maximum length |
| Code 128 | Text such as letters, digits, spaces and punctuation |
| EAN-13 | 12 or 13 digits; with 12 the check digit is added for you, and a 13th must be the correct check digit |
| UPC-A | 11 or 12 digits; with 11 the check digit is added for you, and a 12th must be the correct check digit |
| Code 39 | Digits, capital letters, spaces and the symbols - . $ / + % |
The other controls, in order:
- Value — the fixed text to encode.
- Value path — a field in your data to encode instead (see below). When it is set, it is always used and Value is ignored.
- Width (px) — the printed width in pixels, at 96 pixels to the inch; the height follows in proportion. A new barcode starts at 120 (1.25 in). Empty means the code stretches to the full width of the space it sits in — on the page body, a QR code as wide as the page.
- Show human-readable text (linear codes) — prints the value as text under a Code 128, EAN-13, UPC-A or Code 39 barcode. It has no effect on the other four kinds.
- Alt text — the words printed in place of the code when its value cannot be encoded. Empty means "Invalid barcode value".
- Link URL — makes the code a link when the PDF is read on screen. Start a web address with
https://orhttp://;mailto:email links andtel:phone links work too. Other link types, such asftp:, are refused.
A barcode must have a Value or a Value path — Weft refuses a change that would clear both.
Then come Keep with next block — stay with what follows and the Conditional panel, which for a barcode offers Show only when a condition is met but no conditional styling. A barcode has no Style, Box or Spacing panels and no alignment setting. See Shared element properties.
Binding it to data
- Select the barcode.
- In Value path, type the path of the field to encode — for example
record.InvoiceNumber— and press Enter. Suggestions from the loaded data appear as you type, and a card marked ƒ under the field shows the bound path.
A ⚠ beside the path, or on the card, means it does not resolve in the loaded data; the canvas
and the check before export flag it as This barcode's field won't resolve. To print one
code per line item, put the barcode inside a Repeat element and use the repeated item's field,
for example item.Sku.
The value is encoded exactly as stored: numbers and dates are not formatted first. See Bind fields for loading sample or live data.
When the value is empty or cannot be encoded
A barcode never stops the document rendering. Instead of the code, it prints the Alt text — or "Invalid barcode value" — in small red italic letters. That happens when:
- the Value path finds no value for this record (the fixed Value is not used as a fallback);
- the value does not suit the symbology, such as letters or a space in an EAN-13, the wrong number of digits or a wrong check digit, or lowercase letters in a Code 39;
- the value is too long for the code.
The editor preview shows the same message. A path that does not resolve is marked only in the properties panel — not on the canvas, in the notices dock or in the check before export — so look at the preview with your sample data and with a real record before you send. To leave the space empty rather than print a message, give the barcode a condition on the same field so it only prints when the field has a value (Show only when).
How it prints
A barcode is never split across two pages, and keeps a small gap above and below. Tick Keep with next block to hold it on the same page as the element after it, such as a reference line printed beneath it.