| Crates.io | printers |
| lib.rs | printers |
| version | 2.2.1 |
| created_at | 2022-08-23 01:57:50.847828+00 |
| updated_at | 2025-11-19 00:53:14.263655+00 |
| description | Get printers and print files on unix and windows |
| homepage | https://crates.io/crates/printers |
| repository | https://github.com/talesluna/rust-printers |
| max_upload_size | |
| id | 650680 |
| size | 57,936 |
Provides all system printers, create and manage print jobs.
See the references in docs.rs.
| Target | API | List printers | List jobs | Print bytes and text files | Print PDF,images, etc... |
|---|---|---|---|---|---|
| Unix | cups | ✅ | ✅ | ✅ | ✅ |
| Windows | winspool | ✅ | ✅ | ✅ | 🤔** |
** On Windows this lib use RAW datatype to process printing by default. Expected output depends of printer firmware.
Get all available printers
let printers = get_printers();
// Vec<Printer>
Create print job of an byte array
let job_id = printer.print("42".as_bytes(), PrinterJobOptions::none());
// Result<u64, &'static str>
Create print job of an file
let job_id = printer.print_file("my_file/example/path.txt", PrinterJobOptions {
name: Some("My print job"),
raw_properties: &[
("copies", "2"),
("document-format", "XPS"),
],
});
// Result<u64, &'static str>
Get a printer by name
let my_printer = get_printer_by_name("my_printer");
// Option<Printer>
Get the default printer
let printer = get_default_printer();
// Option<Printer>
Manage state of printer job
// Pause
printer.pause_job(123);
// Resume
printer.resume_job(123);
// Restart
printer.restart_job(123);
// Cancel
printer.cancel_job(123)