Code sections let you embed machine-readable symbols directly in a print job. The plugin supports the four most common code families used in retail, logistics, and ticketing: QR codes, 1D barcodes, DataMatrix, and PDF417. Every code section is validated in Rust before ESC/POS bytes are generated — invalid data or out-of-range parameters throw a descriptive error string that you can catch and display.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/luis3132/tauri-plugin-thermal-printer/llms.txt
Use this file to discover all available pages before exploring further.
Qr
TheQr section renders a QR code symbol. QR codes are the most versatile 2D code format — they handle URLs, plain text, and arbitrary UTF-8 data, and are readable by every modern smartphone camera.
The content to encode. Must not be empty. Maximum length depends on the
error_correction level — the backend throws a descriptive error if the limit is exceeded.Module size in pixels per dot (1–16). Recommended: 5–6 for 80 mm paper.
Error correction level. Higher levels increase recoverability but reduce maximum data capacity. Default in the builder:
"M".QR model variant. Model 2 is the modern standard and supports larger data. Default:
2.Horizontal alignment. Falls back to the current global alignment when omitted.
Error correction reference
| Level | Recovery | Max chars |
|---|---|---|
"L" | ~7% | 7 089 |
"M" | ~15% | 4 296 |
"Q" | ~25% | 2 953 |
"H" | ~30% | 1 817 |
Barcode
TheBarcode section prints a 1D linear barcode. Nine symbologies are supported covering retail, inventory, and general-purpose use cases.
The barcode data string. Must not be empty. Numeric-only symbologies (
UPC-A, UPC-E, EAN13, EAN8, ITF) accept digits only — the backend throws if any non-digit character is detected.The barcode symbology. See the barcode type table below.
Module (bar) width. Range: 1–6. Recommended: 2–3.
Barcode height in printer dots. Must be greater than 0. Recommended: 50–100.
Where to print the human-readable text (HRT) relative to the bars. Use
"none" to suppress it entirely.Horizontal alignment. Falls back to the current global alignment when omitted.
Barcode type reference
| Symbology | barcode_type value | Data type | Typical use |
|---|---|---|---|
| Universal Product Code A | "UPC-A" | 12 digits | US/Canada retail |
| Universal Product Code E | "UPC-E" | 8 digits (compressed) | Small package retail |
| EAN-13 | "EAN13" | 13 digits | International retail |
| EAN-8 | "EAN8" | 8 digits | Small package retail |
| Code 39 | "CODE39" | Uppercase A–Z, 0–9, symbols | Inventory, healthcare |
| Interleaved 2 of 5 | "ITF" | Even-length digits | Shipping cartons |
| Codabar | "CODABAR" | 0–9, A–D, special chars | Libraries, blood banks |
| Code 93 | "CODE93" | Full ASCII | High-density alphanumeric |
| Code 128 | "CODE128" | Full ASCII | General-purpose (recommended) |
DataMatrix
TheDataMatrix section renders a compact 2D matrix code. DataMatrix codes pack data into a very small physical footprint — useful when space is tight but you still need to encode identifiers, serial numbers, or short URLs.
The data string to encode.
Module size (1–16). The builder default is
6.Pdf417
ThePdf417 section prints a PDF417 stacked 2D barcode. PDF417 can encode large amounts of data (including binary) and is commonly used on shipping labels, boarding passes, and government IDs. Rows and columns can be set to 0 to let the encoder choose automatically.
The data string to encode.
Number of data columns.
0 = auto-select; otherwise 1–30.Number of data rows.
0 = auto-select; otherwise 3–90.Module width (2–8). Controls how wide each module column is. Default:
2.Row height (2–8). Controls how tall each symbol row is. Default:
3.Error correction level (0–8). Higher values add more redundancy. Default:
2.