Once the plugin is installed and registered, printing a receipt takes three API calls: list the available printers, build aDocumentation 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.
PrintJobRequest with the sections you want, and call print_thermal_printer(). This guide walks through each step and finishes with a complete, copy-pasteable working example using the builder helpers.
List available printers
Call Each entry in the returned array is a
list_thermal_printers() to discover printers the OS knows about. On desktop this queries CUPS (Linux/macOS) or the Windows spooler; on Android it returns discovered Bluetooth and USB devices.PrinterInfo object:| Field | Type | Description |
|---|---|---|
name | string | Human-readable printer name |
interface_type | string | Connection type, e.g. "USB", "NETWORK" |
identifier | string | Unique identifier — URI for desktop, MAC address for Android Bluetooth |
status | string | Current status, e.g. "IDLE", "BUSY" |
On Android, pass the
identifier (MAC address such as "AA:BB:CC:DD:EE:FF") as the printer field in your PrintJobRequest. The printer must be paired in the Android Bluetooth settings beforehand.Build a print job
A
PrintJobRequest has four fields: the target printer name, an optional paper size, a CodePage encoding configuration, and an array of sections. Sections are typed union variants — each one maps to a distinct ESC/POS element.Send the print job
Pass the
PrintJobRequest to print_thermal_printer(). The function returns Promise<void> and throws a descriptive string on failure — always wrap it in try/catch.Test the printer
Before building a full print job, use All fields after
test_thermal_printer() to send a built-in diagnostic printout. Pass a TestPrintRequest that wraps a minimal PrintJobRequest plus flags for which test sections to include.printer_info are optional. Most diagnostic flags (include_text, include_text_styles, include_alignment, include_columns, include_separators, include_barcode, include_qr, include_beep, cut_paper, test_feed) default to true on the server side; flags for less-common tests (include_barcode_types, include_image, test_cash_drawer, test_all_fonts, test_invert, test_rotate) default to false. You can start with just the printer config and override individual flags as needed.Full Example with Builder Helpers
The builder helpers produce the samePrintSections objects as raw literals but are more concise and provide full TypeScript autocomplete. The receipt below is functionally identical to the raw-object example in Step 2.
Builder reference (quick lookup)
| Helper | Description | Key defaults |
|---|---|---|
title(text, styles?) | { Title: ... } — double-size, centered | — |
subtitle(text, styles?) | { Subtitle: ... } — bold, taller | — |
text(text, styles?) | { Text: ... } — normal text | — |
line(character?) | { Line: ... } — full-width separator | "-" |
feed(value, type?) | { Feed: ... } — advance paper | "lines" |
cut(mode?, feedLines?) | { Cut: ... } — cut paper | "partial", 4 lines |
qr(data, options?) | { Qr: ... } — QR code | size 6, correction "M", model 2 |
barcode(data, type?, options?) | { Barcode: ... } — barcode | "CODE128", width 3, height 80, "below" |
beep(times?, duration?) | { Beep: ... } — audible beep | 1 beep, duration 3 |
drawer(pin?, pulse_time?) | { Drawer: ... } — cash drawer | pin 2, 120 ms |
table(columns, body, options?) | { Table: ... } — columnar table | truncate: true |
Next Steps
Section Types
Explore all 16 section types — Title, Subtitle, Text, Table, QR, Barcode, Image, and more — with full field references.
Android Guide
Learn how Bluetooth pairing works, how to get the MAC address from
list_thermal_printers(), and how to handle Android-specific edge cases.API Reference
Full TypeScript API reference for
print_thermal_printer, list_thermal_printers, test_thermal_printer, and every exported type and constant.