The basic receipt and ticket patterns cover most day-to-day use-cases, but the plugin exposes several more powerful features: a complete catalogue of every section type, document-wideDocumentation 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.
GlobalStyles, paper-size helper functions, test printing with fine-grained control flags, and Android Bluetooth printing. This page explores all of them with realistic, runnable examples.
Complete Builder Showcase
The snippet below builds a singlePrintJobRequest using every available builder helper. Use it as a reference when wiring up a new section type — each block is annotated with what it does and why you would reach for it.
GlobalStyles: Document-Wide Defaults and Per-Section Overrides
GlobalStyles is a regular section — it sets a “current style” state in the print engine that all subsequent Text, Subtitle, and Table cells inherit. Insert a new GlobalStyles section whenever you want to switch modes (e.g., switch to centred alignment for a footer block).
GlobalStyles affects only subsequent sections. Sections that appear
before it in the array are unaffected. Individual style properties on a
Text/Title/Subtitle section temporarily override the global value for
that one section only.Paper Size Helpers
The TypeScript package exports constants and helper functions that mirror the values used inside the Rust backend, so you can calculate column widths programmatically instead of hard-coding them.PaperSize | Chars / line | Pixels wide |
|---|---|---|
"Mm40" | 21 | 256 |
"Mm44" | 24 | 288 |
"Mm58" | 32 | 384 |
"Mm72" | 42 | 512 |
"Mm80" | 48 | 576 |
"Mm104" | 62 | 752 |
Dynamic Column Widths
Computecolumn_widths from the paper size at runtime so the same function works on both 58 mm and 80 mm printers.
Test Printing
test_thermal_printer() runs a built-in self-test and is the fastest way to verify that a printer is correctly configured. Every flag is optional — omit flags you do not need.
test_thermal_printer returns Promise<void> and throws a string on
failure, just like print_thermal_printer. Always wrap calls in try/catch.Android Bluetooth Printing
On Android theprinter field must be the Bluetooth MAC address of the printer (e.g. "AA:BB:CC:DD:EE:FF"). The device must already be paired in the Android Bluetooth settings. Use list_thermal_printers() to discover available Bluetooth printers at runtime.