Skip to main content

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.

Android support in the Tauri Plugin Thermal Printer works through a Kotlin plugin that bridges Rust-generated ESC/POS binary data to a physical printer over Bluetooth SPP (Serial Port Profile). Because Android’s printing model is fundamentally different from desktop CUPS/WinAPI, there are a number of Android-specific requirements and constraints to be aware of before you start.
iOS is not supported. The plugin registers an iOS binding stub but all method calls return an UnsupportedPlatform error. Do not attempt to use this plugin on iOS.

Requirements and Limitations

Bluetooth Only for Printing

Actual printing on Android is done exclusively over Bluetooth SPP (RFCOMM). USB is available for discovery only — you cannot print to a USB-connected printer from Android.

No Network Printing

Network printer scanning is present in the source code but intentionally disabled. Network printing is not supported on Android.

Pairing Required

The target printer must be previously paired in the Android system Bluetooth settings before the plugin can connect. The plugin connects to bonded (paired) devices only.

MAC Address as Identifier

Unlike desktop platforms where you use a printer name, on Android the printer field in PrintJobRequest must be the Bluetooth MAC address of the printer (e.g. "AA:BB:CC:DD:EE:FF").

Bluetooth Permissions

All required Bluetooth permissions are requested automatically at runtime when you call list_thermal_printers() or print_thermal_printer() for the first time. You do not need to add any manual permission-request logic. The following Android permissions are bundled with the plugin:
PermissionPurpose
BLUETOOTHClassic Bluetooth operations (legacy API)
BLUETOOTH_ADMINStarting/stopping Bluetooth discovery
BLUETOOTH_SCANScanning for nearby Bluetooth devices (Android 12+)
BLUETOOTH_CONNECTConnecting to paired devices (Android 12+)
ACCESS_FINE_LOCATIONRequired by Android to use Bluetooth scanning
ACCESS_COARSE_LOCATIONRequired by Android to use Bluetooth scanning
If the user denies the Bluetooth permission, the plugin rejects the call with the error "Bluetooth permission denied". Show a user-friendly message explaining why the permission is needed.

Discovering Printers on Android

Call list_thermal_printers() to retrieve all discoverable printers. On Android this queries two sources in sequence:
  • Bluetooth — iterates over all paired (bonded) devices and filters for those that look like printers (by Bluetooth device class, or names containing “printer”, “print”, “POS”, or “thermal”).
  • USB — iterates over connected USB devices and checks for the USB printer interface class (bDeviceClass = 7). USB printers appear in the list with interface_type: "USB" but cannot be printed to.
import {
  list_thermal_printers,
  type PrinterInfo,
} from "tauri-plugin-thermal-printer";

try {
  const printers: PrinterInfo[] = await list_thermal_printers();
  console.log(printers);
  // Example output:
  // [
  //   {
  //     "name": "EPSON TM-m30",
  //     "interface_type": "Bluetooth",
  //     "identifier": "AA:BB:CC:DD:EE:FF",
  //     "status": "Paired"
  //   },
  //   {
  //     "name": "USB Printer",
  //     "interface_type": "USB",
  //     "identifier": "VID:1208/PID:514",
  //     "status": "Connected"
  //   }
  // ]
} catch (error) {
  console.error("Could not list printers:", error);
}
The identifier field for Bluetooth printers contains the MAC address you need to use as the printer field when printing.

Printing on Android

Pass the printer’s Bluetooth MAC address as the printer field in your PrintJobRequest. The Kotlin layer uses this identifier to look up the paired device and open an RFCOMM socket.
import {
  print_thermal_printer,
  ENCODE,
  type PrintJobRequest,
} from "tauri-plugin-thermal-printer";

const job: PrintJobRequest = {
  // MAC address of the paired Bluetooth printer
  printer: "AA:BB:CC:DD:EE:FF",
  paper_size: "Mm80",
  options: {
    code_page: 0,
    encode: ENCODE.ACCENT_REMOVER,
  },
  sections: [
    { Title: { text: "Order #1042" } },
    { Text: { text: "Thank you for your purchase!" } },
    { Line: { character: "-" } },
    {
      Table: {
        columns: 2,
        body: [
          [{ text: "Americano" }, { text: "$2.50" }],
          [{ text: "Croissant" }, { text: "$3.50" }],
        ],
      },
    },
    { Line: { character: "=" } },
    { Text: { text: "Total: $6.00", styles: { bold: true } } },
    { Feed: { feed_type: "lines", value: 3 } },
    { Cut: { mode: "partial", feed: 0 } },
  ],
};

try {
  await print_thermal_printer(job);
  console.log("Print job sent successfully");
} catch (error) {
  console.error("Print failed:", error);
}

Connection Types on Android

ConnectionDiscoveryPrinting
Bluetooth (SPP/RFCOMM)✅ Paired devices only✅ Full print support
USB✅ Lists connected printers❌ Not supported
Network❌ Disabled❌ Not supported
Bluetooth discovery only returns already-paired devices. The plugin does not initiate a fresh Bluetooth scan for unpaired devices — it reads from the system’s bonded device list.

Pairing Your Printer

Before the plugin can connect, you must pair the printer once through Android’s system settings:
1

Enable Bluetooth on the printer

Power on the printer and ensure its Bluetooth radio is active. Consult your printer’s manual for the specific steps — many thermal printers enter pairing mode by holding a button during power-on.
2

Open Android Bluetooth settings

On the Android device, go to Settings → Connected devices → Pair new device (exact wording varies by manufacturer).
3

Select the printer

The printer should appear in the list of available devices. Tap it to pair. Most thermal printers do not require a PIN; if prompted, try 0000 or 1234.
4

Confirm pairing

Once paired, the printer appears in the Paired devices list. It will now be returned by list_thermal_printers() and can be used as the printer field.

Troubleshooting

The user rejected the Bluetooth permission prompt. Guide users to Settings → Apps → [Your App] → Permissions → Nearby devices and enable it. On Android versions below 12, the location permission controls Bluetooth access — ensure ACCESS_FINE_LOCATION is granted.
The device’s Bluetooth radio is off. Prompt the user to enable Bluetooth in the system quick settings panel before retrying.
The device does not have a Bluetooth adapter, or the Android system could not obtain a BluetoothManager reference. This is rare on modern Android devices but can occur on certain emulators.
The printer must be paired before it can be discovered. If the printer does not appear, complete the pairing step in Android Bluetooth settings first. Also confirm that the printer’s name or Bluetooth device class matches the plugin’s detection heuristics (name contains “printer”, “print”, “POS”, or “thermal”, or device class matches the Imaging major class 0x0600 or the printer subclass 0x0680).
Bluetooth RFCOMM connections can time out if the printer takes too long to process a large job. Reduce image resolution, use fewer sections, or increase Bluetooth transmit power in the printer’s settings if available.

Build docs developers (and LLMs) love