basic/
basic.rs

1use escpos_rust::{Printer, PrinterProfile, command::Font};
2
3fn main() {
4    let printer_profile = PrinterProfile::terminal_builder().with_font_width(Font::FontA, 20).build();
5    // We pass it to the printer
6    let printer = match Printer::new(printer_profile) {
7        Ok(maybe_printer) => match maybe_printer {
8            Some(printer) => printer,
9            None => panic!("No printer was found :(")
10        },
11        Err(e) => panic!("Error: {}", e)
12    };
13    
14    // We print simple text
15    match printer.println("Hello, world!") {
16        Ok(_) => (),
17        Err(e) => println!("Error: {}", e)
18    }
19}