pub struct Config { /* private fields */ }Implementations§
Source§impl Config
impl Config
Sourcepub fn new(model: Model, serial: String, media: Media) -> Config
pub fn new(model: Model, serial: String, media: Media) -> Config
Initialize configuration data with default values.
This method receives model and media. They are not modifiable after the initialization.
§Example
use ptouch::{Config, ContinuousType, Media, Model};
let media = Media::Continuous(ContinuousType::Continuous29);
let model = Model::QL800;
let config = Config::new(model, "serial".to_string(), media);Sourcepub fn enable_auto_cut(self, size: u8) -> Self
pub fn enable_auto_cut(self, size: u8) -> Self
Enable auto cut after printing specified number of labels.
§Arguments
size- Number of labels to print before auto-cutting (1-255)
§Example
let config = Config::new(Model::QL820NWB, "serial".to_string(),
Media::Continuous(ContinuousType::Continuous62))
.enable_auto_cut(3); // Cut after every 3 labelsSourcepub fn disable_auto_cut(self) -> Self
pub fn disable_auto_cut(self) -> Self
Disable automatic cutting of labels.
When disabled, labels will need to be manually torn or cut.
§Example
let config = Config::new(Model::QL820NWB, "serial".to_string(),
Media::Continuous(ContinuousType::Continuous62))
.disable_auto_cut();Sourcepub fn cut_at_end(self, flag: bool) -> Self
pub fn cut_at_end(self, flag: bool) -> Self
Sourcepub fn high_resolution(self, high: bool) -> Self
pub fn high_resolution(self, high: bool) -> Self
Enable or disable high resolution printing.
High resolution doubles the vertical resolution from 300 DPI to 600 DPI. When enabled, image height should be doubled accordingly.
§Arguments
high-truefor 600 DPI,falsefor 300 DPI
§Example
let config = Config::new(Model::QL820NWB, "serial".to_string(),
Media::Continuous(ContinuousType::Continuous62))
.high_resolution(true); // Enable 600 DPISourcepub fn set_feed_in_dots(self, feed: u16) -> Self
pub fn set_feed_in_dots(self, feed: u16) -> Self
Set the feeding length in dots.
Controls how much tape is fed before printing starts. Different media types have different valid ranges.
§Arguments
feed- Feed length in dots
§Example
let config = Config::new(Model::QL820NWB, "serial".to_string(),
Media::Continuous(ContinuousType::Continuous62))
.set_feed_in_dots(150); // Set feed to 150 dotsSourcepub fn two_colors(self, two_colors: bool) -> Self
pub fn two_colors(self, two_colors: bool) -> Self
Enable or disable two-color printing (black and red).
Only supported on QL-820NWB with compatible red/black tape.
When enabled, use print_two_color() method instead of print().
§Arguments
two_colors-trueto enable two-color printing
§Example
let config = Config::new(Model::QL820NWB, "serial".to_string(),
Media::Continuous(ContinuousType::Continuous62Red))
.two_colors(true); // Enable red and black printingSourcepub fn compress(self, flag: bool) -> Self
pub fn compress(self, flag: bool) -> Self
Enable or disable data compression.
Uses PackBits compression to reduce USB transfer size. Automatically disabled for QL-800 model due to hardware limitations.
§Arguments
flag-trueto enable compression
§Example
let config = Config::new(Model::QL820NWB, "serial".to_string(),
Media::Continuous(ContinuousType::Continuous62))
.compress(true); // Enable compression