Crates.io | brother_ql |
lib.rs | brother_ql |
version | 1.0.6 |
source | src |
created_at | 2024-03-07 20:30:32.803445 |
updated_at | 2024-10-02 19:33:34.001888 |
description | Generate Brother QL Raster Command data from images |
homepage | |
repository | https://github.com/mkienitz/brother_ql |
max_upload_size | |
id | 1166266 |
size | 52,356 |
This is a crate to convert image data to the Raster Command binary data understood by the Brother QL-820NWB label printer.
Here is a small example on how to use it:
use std::{error::Error, fs::File, io::Write};
use brother_ql::{
printjob::{CutBehavior, PrintJob},
media::Media,
};
pub fn main() -> Result<(), Box<dyn Error>> {
let img = image::open("test.png")?;
let job = PrintJob {
no_pages: 1,
image: img,
media: Media::C62, // use 62mm wide continuous tape
high_dpi: false,
compressed: false, // unsupported
quality_priority: false, // no effect on two-color printing
cut_behaviour: CutBehavior::CutAtEnd,
};
let data = job.compile()?;
let mut file = File::create("test.bin")?;
let _ = file.write(&data);
// We can now send this binary directly to the printer, for example using `nc`
Ok(())
}