From 3ba4bcd2f8bd17a1a4311a6f247cd45b7d4b596a Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 22 Feb 2025 16:26:06 +0100 Subject: [PATCH] Update escpos to 0.15.0 --- Cargo.lock | 11 ++--------- Cargo.toml | 2 +- showbits-thermal-printer/src/printer.rs | 7 +++++-- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9bc305f..0bc0f18 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -753,12 +753,11 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "escpos" -version = "0.12.2" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61072257bf7231b08a87c29e904ccdc1e7e140b3af19b865ba98aaa19eeaa48" +checksum = "eafeb6ffc6e8f07aa93e0c7be9d4017e60af96c988d9b3e1060df3d1459f8908" dependencies = [ "encoding_rs", - "lazy_static", "log", ] @@ -1428,12 +1427,6 @@ dependencies = [ "arrayvec", ] -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - [[package]] name = "lebe" version = "0.5.2" diff --git a/Cargo.toml b/Cargo.toml index e5cace6..e114563 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ axum = "0.8.1" clap = { version = "4.5.30", features = ["derive", "deprecated"] } comemo = "0.4.0" cosmic-text = "0.12.1" -escpos = "0.12.2" +escpos = "0.15.0" image = "0.25.1" mark.git = "https://github.com/Garmelon/mark.git" mime_guess = "2.0.4" diff --git a/showbits-thermal-printer/src/printer.rs b/showbits-thermal-printer/src/printer.rs index c10adcf..124da2f 100644 --- a/showbits-thermal-printer/src/printer.rs +++ b/showbits-thermal-printer/src/printer.rs @@ -3,6 +3,7 @@ use std::path::PathBuf; use escpos::{ driver::FileDriver, printer::Printer as EPrinter, + printer_options::PrinterOptions, utils::{GS, PageCode, Protocol}, }; use image::{Rgba, RgbaImage}; @@ -44,8 +45,10 @@ impl Printer { ) -> anyhow::Result { let printer = if let Some(path) = printer_path { let driver = FileDriver::open(&path)?; - let printer = EPrinter::new(driver, Protocol::default(), Some(Self::PAGE_CODE)); - Some(printer) + let protocol = Protocol::default(); + let mut options = PrinterOptions::default(); + options.page_code(Some(Self::PAGE_CODE)); + Some(EPrinter::new(driver, protocol, Some(options))) } else { None };