Crates.io | escposify |
lib.rs | escposify |
version | |
source | src |
created_at | 2016-04-29 15:45:40.866357 |
updated_at | 2025-01-09 09:43:45.5794 |
description | A ESC/POS driver for Rust ## Minimum Rust version policy (MSRV) This crate's minimum supported rustc version is 1.46.0. |
homepage | |
repository | https://github.com/local-group/rust-escposify |
max_upload_size | |
id | 4906 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
A ESC/POS driver for Rust
Most ESC/POS Printers will appear as a file. To print to the device, open a file to the location and pass this to the File::from
function.
To enable this in Windows, install the printer and its driver. Share the printer and specifiy a name for it (Receipt Printer in this case). The printer will then be accessable via \\%COMPUTERNAME%\Receipt Printer
.
To test this in the command line:
echo "Hello World" > testfile
copy testfile "\\%COMPUTERNAME%\Receipt Printer"
del testfile
See: simple.rs
extern crate escposify;
extern crate tempfile;
use std::io;
use escposify::device::File;
use escposify::printer::Printer;
use tempfile::NamedTempFileOptions;
fn main() -> io::Result<()> {
let tempf = NamedTempFileOptions::new().create().unwrap();
let file = File::from(tempf);
let mut printer = Printer::new(file, None, None);
printer
.chain_font("C")?
.chain_align("lt")?
.chain_style("bu")?
.chain_size(0, 0)?
.chain_text("The quick brown fox jumps over the lazy dog")?
.chain_text("敏捷的棕色狐狸跳过懒狗")?
.chain_barcode("12345678", "EAN8", "", "", 0, 0)?
.chain_feed(1)?
.chain_cut(false)?
.flush()
}