Interface with printers through Powershell, enabled by a Cargo feature
This plugin is currently under development, any bugs please understand
If you are installing from npm and crate.io package registry, make sure the mayor and minor versions for both packages are the same, otherwise, the API may not match.
Crate: https://crates.io/crates/tauri-plugin-printer
Install latest version:
cargo add tauri-plugin-printer
Or add the following to your Cargo.toml
for spesific version:
src-tauri/Cargo.toml
toml
[dependencies]
tauri-plugin-printer = { version = "0.2.2" }
You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
```sh pnpm add tauri-plugin-printer
npm add tauri-plugin-printer
yarn add tauri-plugin-printer ```
First you need to register the core plugin with Tauri:
src-tauri/src/main.rs
rust
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_printer.init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript import {listprinters} from "tauri-plugin-printer"; // get list printers const list = await listprinters()
// print pdf file await printpdf('path/to/file.pdf', 'printername')
```
https://saweria.co/alfianlensun
Code: (c) 2023 - Present Alfian Lensun.
MIT where applicable.