Getting the thermal printer plugin into your Tauri v2 project takes four steps: add the Rust crate, add the npm package, register the plugin in your app’s entry point, and grant the required capabilities. The sections below walk through each step, plus an alternative local-path installation for contributors or monorepo setups.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.
Add the Rust crate
Run the following command from your This pins the latest
src-tauri directory to add the crate to your Cargo.toml:2.0.1 release. If you want to pin the version explicitly, your Cargo.toml entry will look like this:Add the npm package
Install the TypeScript/JavaScript bindings from your project root using whichever package manager you prefer:The npm package ships fully typed TypeScript definitions (
dist-js/index.d.ts) as well as ESM and CJS builds. It also exports all builder helpers, style constants, and type interfaces — no separate @types package is needed.Register the plugin in lib.rs
Open
src-tauri/src/lib.rs and add .plugin(tauri_plugin_thermal_printer::init()) to your tauri::Builder chain before .run(...):tauri_plugin_thermal_printer::init() registers the three IPC commands (print_thermal_printer, list_thermal_printers, test_thermal_printer) and sets up both the desktop and Android backends automatically.Grant capabilities
Tauri v2 requires you to explicitly allow each IPC command your frontend can call. Open (or create) Alternatively you can use the bundled
src-tauri/capabilities/default.json and add the three thermal-printer permissions:thermal-printer:default shorthand, which grants all allow-* permissions (including allow-ping) at once:| Permission identifier | Command enabled |
|---|---|
thermal-printer:allow-list-thermal-printers | list_thermal_printers() |
thermal-printer:allow-print-thermal-printer | print_thermal_printer() |
thermal-printer:allow-test-thermal-printer | test_thermal_printer() |
Alternative: Local Path Installation
If you want to use a local clone — for example, to contribute to the plugin or to patch it in a monorepo — build the plugin from source first and then point both Cargo and your package manager at the local path. 1. Clone and buildsrc-tauri/Cargo.toml:
package.json:
Android note: The plugin requests Bluetooth runtime permissions automatically on Android (BLUETOOTH_CONNECT, BLUETOOTH_SCAN). You do not need to add permission declarations to your
AndroidManifest.xml or handle the permission dialog yourself — the Kotlin plugin layer takes care of it.