1 stable release

new 1.0.0 Jan 11, 2025

#345 in Hardware support

MIT license

12KB
163 lines

escpos-rw: USB communication with ESC/POS (Epson) thermal printers

Escpos-rw is a "low level" fork of escpos-rs, aiming at providing the USB connection and read/write functions.

  • bug fixes
  • cleaning unused and unwanted code
  • adding read functionality

You can find ESC/POS Command Reference here.

Creating the printer object

// Creating the printer object
    let Some(printer) = Printer::new(0x04b8, 0x0202)? else {
        return Err(escpos_rw::Error::PrinterError(
            "No printer found !".to_string(),
        ));
    };

Sending data

The printer object has a write_raw method...

// Open the cash drawer
printer.write_raw([0x1B, 0x70, 0x00, 0x7E, 0x7E])?;

Reading data

...and a read_raw method:

// Reads data from printer output buffer
printer.read_raw()?;

lib.rs:

escpos-rw: USB communication with ESC/POS (Epson) thermal printers

escpos-rw is a "low level" fork of escpos-rs, aiming at providing the USB connection and read/write functions.

  • bug fixes
  • cleaning unused and unwanted code
  • adding read functionality

Dependencies

~1.5MB
~34K SLoC