printers

Crates.ioprinters
lib.rsprinters
version2.2.1
created_at2022-08-23 01:57:50.847828+00
updated_at2025-11-19 00:53:14.263655+00
descriptionGet printers and print files on unix and windows
homepagehttps://crates.io/crates/printers
repositoryhttps://github.com/talesluna/rust-printers
max_upload_size
id650680
size57,936
Tales Luna (talesluna)

documentation

README

Printers: A printing APIs implementation for unix (cups) and windows (winspool).

Provides all system printers, create and manage print jobs.

Crates.io Version Crates.io License docs.rs Crates.io Downloads (recent)

Documentation

See the references in docs.rs.

🛠️ Features

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.

👇 Examples

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)

⏳ Future

  • GhostScript option conversion support
Commit count: 74

cargo fmt