space_split/
space_split.rs

1use escpos_rust::{Printer, PrinterProfile, command::Font};
2
3fn main() {
4    let printer_profile = PrinterProfile::terminal_builder().with_font_width(Font::FontA, 32).build();
5    // We pass it to the printer
6    let mut 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    // We set word splitting
14    printer.set_space_split(true);
15
16    // We print simple text
17    match printer.println("Really long sentence that should be splitted into three components, yay!") {
18        Ok(_) => (),
19        Err(e) => println!("Error: {}", e)
20    }
21}