Every type described here is exported fromDocumentation 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.
tauri-plugin-thermal-printer and can be imported directly. Interfaces describe the shape of objects you pass to or receive from the three main functions; the PrintSections union type is the building block of every print job’s sections array.
PrintJobRequest
The top-level object passed to print_thermal_printer. It describes the target printer, the paper size, the encoding options, and the ordered list of sections to render.
Name of the printer as registered with the OS (e.g.
"TM-T20II"). On Android, supply the Bluetooth MAC address (e.g. "AA:BB:CC:DD:EE:FF").Ordered array of content sections. See
PrintSections for all supported variants.Roll width. See
PaperSize for available values and their character/pixel metrics. Use DEFAULT_PAPER_SIZE ('Mm80') when in doubt.PrinterInfo
Returned as elements of the array from list_thermal_printers.
Human-readable printer name as registered with the OS (e.g.
"TM-T20II").Connection interface type (e.g.
"USB", "NETWORK", "BLUETOOTH").Unique device identifier such as a USB URI or
"IP:PORT" string (e.g. "192.168.1.100:9100").Current printer status (e.g.
"IDLE", "BUSY").CodePage
Controls two independent concerns: the ESC/POS code-page command sent to the printer (ESC t n) and the host-side character encoding applied before bytes are transmitted.
Raw value for the
ESC t n command. Each printer model maps its own page numbers; consult your printer’s programming manual.Host-side encoding applied to all text sections.
ENCODE.ACCENT_REMOVER transliterates accented characters to plain ASCII before transmission (á → a, ß → ss, € → EUR). All other values come from encoding_rs statics. See ENCODE.When
true, characters that the selected encode cannot represent are retried with GBK before falling back to raw UTF-8 bytes.GlobalStyles
Optional style overrides applied to a text section. When used as a PrintSections variant ({ GlobalStyles: ... }), the styles become the default for all subsequent text sections until changed again.
Bold text.
Underlined text.
Horizontal alignment —
'left' | 'center' | 'right'.Italic text (hardware support varies by printer model).
White text on a black background.
Printer font —
'A' | 'B' | 'C'.Rotate text 90 degrees clockwise.
Print text upside down.
Character size —
'normal' | 'height' | 'width' | 'double'.PaperSize
String literal union that identifies the roll width. Use DEFAULT_PAPER_SIZE ('Mm80') when in doubt.
| Value | Paper Width | Chars / Line | Pixels Width | Typical Use |
|---|---|---|---|---|
'Mm40' | 40 mm | 21 | 256 | Handheld ticket printers |
'Mm44' | 44 mm | 24 | 288 | Compact POS |
'Mm58' | 58 mm | 32 | 384 | Small format, portable |
'Mm72' | 72 mm | 42 | 512 | Mid-range printers |
'Mm80' | 80 mm | 48 | 576 | Standard large format (default) |
'Mm104' | 104 mm | 62 | 752 | Wide format |
PrintSections
A discriminated union of all 16 printable section variants. Every element of the sections array in PrintJobRequest must be one of these shapes.
TestPrintRequest
Passed to test_thermal_printer. All fields except printer_info are optional.
Printer configuration. The
sections array is ignored — the backend generates all test content from the flags below.Print a basic text sample.
Print the string in
custom_text.Custom text printed when
include_custom_text is true.Print bold, underline, and inverted style samples.
Print left, center, and right alignment samples.
Print a multi-column table sample.
Print horizontal separator line samples.
Print a CODE128 barcode sample.
Print one sample for each supported barcode type.
Print a QR code sample.
Print the image provided in
image_base64.Base64-encoded image used when
include_image is true.Emit an audible beep.
Open the cash drawer.
Cut the paper at the end of the test.
Run a paper-feed test.
Print a sample in every available font (A, B, C).
Print an inverted-text sample.
Print a 90°-rotated text sample.
Section Interfaces
Each variant ofPrintSections wraps one of the following interfaces.
Title
Prints text with forced double size and center alignment.
Text to print.
Optional style overrides. Defaults force double size and center alignment.
Subtitle
Prints text with forced bold and increased height.
Text to print.
Optional style overrides. Defaults force bold and height size.
Text
Prints body text with fully optional styles.
Text to print.
Optional style overrides. Inherits current global styles when omitted.
Feed
Advances the paper.
'lines' — advance N lines (ESC d n); 'dots' — advance N dot rows (ESC J n); 'line_feed' — send N raw LF characters.Amount to advance.
Cut
Cuts the paper.
Lines to advance before cutting.
Beep
Emits an audible beep via the printer’s buzzer.
Number of beeps (1–9).
Duration per beep in milliseconds (1–255).
Drawer
Opens the cash drawer.
Drawer kick pin number.
Kick pulse duration in milliseconds.
Table
Prints a columnar table. Column widths must sum to the paper’s chars_per_line when provided.
Number of columns.
Per-column widths in characters. Length must equal
columns and the sum must equal the paper’s chars/line (e.g. 48 for Mm80). Evenly distributed when omitted.Optional column header cells — must have exactly
columns elements.Data rows — each row must have exactly
columns cells.When
true, cell text that exceeds its column width is truncated. When false, long text wraps.Qr
Prints a QR code.
QR payload. Must not be empty. Max length depends on error-correction level.
Module size 1–16 (recommended 5–6).
'L' (7%, 7089 chars max) | 'M' (15%, 4296 chars) | 'Q' (25%, 2953 chars) | 'H' (30%, 1817 chars).QR model. Model 2 is recommended.
Horizontal alignment. Defaults to current global alignment.
Barcode
Prints a 1-D barcode.
Barcode payload. Must not be empty. Numeric-only types (
UPC-A, UPC-E, EAN13, EAN8, ITF) accept only digit characters.One of:
'UPC-A' | 'UPC-E' | 'EAN13' | 'EAN8' | 'CODE39' | 'ITF' | 'CODABAR' | 'CODE93' | 'CODE128'.Bar module width 2–6.
Bar height in dots (must be greater than 0).
'none' | 'above' | 'below' | 'both'.Horizontal alignment. Defaults to current global alignment.
DataMatrixModel
Prints a DataMatrix 2-D code.
DataMatrix payload.
Module size 1–16.
Pdf417
Prints a PDF417 stacked barcode.
PDF417 payload.
0 for auto, or 1–30 data columns.0 for auto, or 3–90 data rows.Module width
2–8.Row height
2–8.Error correction level
0–8.Image
Prints a raster image. Base64 strings with or without a data: URI prefix are both accepted.
Base64-encoded image. Must not be empty.
Maximum output width in pixels.
0 (or values larger than the paper width) are automatically clamped to the paper width.Horizontal alignment:
'left' | 'center' | 'right'.Apply Floyd-Steinberg dithering for better quality on monochrome printers.
Print scale —
'normal' | 'double_width' | 'double_height' | 'quadruple'.Logo
Prints a logo image previously stored in the printer’s NV memory.
NV memory key code (1–255).
Print scale —
'normal' | 'double_width' | 'double_height' | 'quadruple'.Line
Prints a full-width horizontal separator by repeating a single character across the paper.
The character to repeat (e.g.
'-', '=', '_'). Must be a single character.Primitive Type Aliases
These string-literal unions are used throughout the interfaces above and are exported as both types and constant objects.| Type | Values |
|---|---|
TextAlign | 'left' | 'center' | 'right' |
TextSize | 'normal' | 'height' | 'width' | 'double' |
TextFont | 'A' | 'B' | 'C' |
BarcodeType | 'UPC-A' | 'UPC-E' | 'EAN13' | 'EAN8' | 'CODE39' | 'ITF' | 'CODABAR' | 'CODE93' | 'CODE128' |
BarcodeTextPosition | 'none' | 'above' | 'below' | 'both' |
QrErrorCorrection | 'L' | 'M' | 'Q' | 'H' |
ImageMode | 'normal' | 'double_width' | 'double_height' | 'quadruple' |
FeedType | 'lines' | 'dots' | 'line_feed' |
CutMode | 'full' | 'partial' | 'partial_alt' | 'partial_alt2' |
Encode | All values of the ENCODE constant object (e.g. 'BIG5', 'WINDOWS_1252', 'ACCENT_REMOVER') |