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.

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.
1

Add the Rust crate

Run the following command from your src-tauri directory to add the crate to your Cargo.toml:
cargo add tauri-plugin-thermal-printer
This pins the latest 2.0.1 release. If you want to pin the version explicitly, your Cargo.toml entry will look like this:
[dependencies]
tauri-plugin-thermal-printer = "2.0.1"
2

Add the npm package

Install the TypeScript/JavaScript bindings from your project root using whichever package manager you prefer:
bun add tauri-plugin-thermal-printer
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.
3

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(...):
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
    tauri::Builder::default()
        .invoke_handler(tauri::generate_handler![greet])
        .plugin(tauri_plugin_thermal_printer::init())
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}
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.
4

Grant capabilities

Tauri v2 requires you to explicitly allow each IPC command your frontend can call. Open (or create) src-tauri/capabilities/default.json and add the three thermal-printer permissions:
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "default",
  "description": "enables the default permissions",
  "windows": ["main"],
  "permissions": [
    "core:default",
    "thermal-printer:allow-list-thermal-printers",
    "thermal-printer:allow-print-thermal-printer",
    "thermal-printer:allow-test-thermal-printer"
  ]
}
Alternatively you can use the bundled thermal-printer:default shorthand, which grants all allow-* permissions (including allow-ping) at once:
{
  "permissions": [
    "core:default",
    "thermal-printer:default"
  ]
}
Permission identifierCommand enabled
thermal-printer:allow-list-thermal-printerslist_thermal_printers()
thermal-printer:allow-print-thermal-printerprint_thermal_printer()
thermal-printer:allow-test-thermal-printertest_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 build
git clone https://github.com/luis3132/tauri-plugin-thermal-printer
cd tauri-plugin-thermal-printer
cargo build --release && bun i && bun run build
2. Point Cargo at the local path In src-tauri/Cargo.toml:
[dependencies]
tauri-plugin-thermal-printer = { path = "../../tauri-plugin-thermal-printer" }
3. Point your package manager at the local path In your frontend package.json:
{
  "dependencies": {
    "tauri-plugin-thermal-printer": "file:../tauri-plugin-thermal-printer"
  }
}
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.

Build docs developers (and LLMs) love