pub struct Printer { /* private fields */ }Implementations§
Source§impl Printer
impl Printer
Sourcepub fn new() -> Printer
pub fn new() -> Printer
Call this function to create a new printer object. It will start with the initial values ESC and @ which initializes the printer. This is done in order to reset the printer to initial state
Sourcepub fn add(&mut self, text: Vec<u8>)
pub fn add(&mut self, text: Vec<u8>)
Add a list of u8 characters to be printed. This is intended to mainly be used to print plaintext. It could however be used for commands as well.
Sourcepub fn add_qr(&mut self, qr: Qr)
pub fn add_qr(&mut self, qr: Qr)
Prints the given qr code. The qr code is to be constructed with the qr submodule..
Sourcepub fn add_str(&mut self, text: &str)
pub fn add_str(&mut self, text: &str)
Add a list of str to be printed. keep in mind that the printer only works on ASCII characters. So it’s the responsibility of the callee to make sure that the string is ASCII. If not then it will most likely be malformed.
Sourcepub fn set_double_strike(&mut self, value: u8)
pub fn set_double_strike(&mut self, value: u8)
This function will turn on or off double strike mode This is done by giving either the value constants::ON or constants::OFF
Sourcepub fn set_emph(&mut self, value: u8)
pub fn set_emph(&mut self, value: u8)
Call this to either turn on or off emphisized text. This is done by giving either the value constants::ON or constants::OFF
Sourcepub fn set_smoothing(&mut self, value: u8)
pub fn set_smoothing(&mut self, value: u8)
Call this to turn smoothing on or off This is done by giving either the value constants::ON or constants::OFF
Sourcepub fn set_barcode_height(&mut self, height: u8)
pub fn set_barcode_height(&mut self, height: u8)
This function will set the height of the barcode. The actual height depends on the printer, try and find what works for you. Can be given values between 0-255
Sourcepub fn set_barcode_width(&mut self, width: u8)
pub fn set_barcode_width(&mut self, width: u8)
This function will set the width of the barcode The actual width depends on the printer, try and find what works for you. Can be given values between 2-6 Not sure why this is the case, but it is. Will set to either highest or lowest if out of range.
Sourcepub fn add_barcode(&mut self, text: &str, barcode_type: u8, mode: u8)
pub fn add_barcode(&mut self, text: &str, barcode_type: u8, mode: u8)
Prints a given barcode The barcode to print is given as a str There can be different types of barcodes. Check which you want to print https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=128 There are two kinds of ways to print barcode, either constant::MODE_A or constant::MODE_B You have to know which mode is right for you.
Sourcepub fn reverse_feed(&mut self, lines: u8)
pub fn reverse_feed(&mut self, lines: u8)
Call this to reverse feed paper. This is done by giving the number of lines to reverse feed. The maximum number of lines is 255. WARNING: I don’t think this works on most printers
Sourcepub fn set_upside_down(&mut self, value: u8)
pub fn set_upside_down(&mut self, value: u8)
Call this to either turn on or off upside down text This is done by giving either the value constants::ON or constants::OFF
Sourcepub fn set_underline(&mut self, value: u8)
pub fn set_underline(&mut self, value: u8)
Call this to either set underline text on or off This is done by giving either the value constants::SINGLE, constant::DOUBLE or constants::OFF
Sourcepub fn set_line_spacing(&mut self, value: u8)
pub fn set_line_spacing(&mut self, value: u8)
Call this to change the spacing between lines This is done by giving a value between 0 and 255
Sourcepub fn set_default_line_spacing(&mut self)
pub fn set_default_line_spacing(&mut self)
Call this to set back to the default line spacing
pub fn cut(&mut self)
Sourcepub fn print_stdout(&self)
pub fn print_stdout(&self)
Prints the message straight to stdout
Sourcepub fn print_file(&self, path: &str)
pub fn print_file(&self, path: &str)
Prints the message to a file The path is given as a str
Auto Trait Implementations§
impl Freeze for Printer
impl RefUnwindSafe for Printer
impl Send for Printer
impl Sync for Printer
impl Unpin for Printer
impl UnwindSafe for Printer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more