Closed agkyunromb closed 1 year ago
use rxing::helpers::save_file; use rxing::common::BitMatrix; use rxing::pdf417::encoder::Dimensions; use rxing::pdf417::PDF417Writer; use rxing::BarcodeFormat::PDF_417; use rxing::EncodeHintType::{ERROR_CORRECTION, MARGIN, PDF417_COMPACT, PDF417_DIMENSIONS}; use rxing::EncodeHintValue::{ErrorCorrection, Margin, Pdf417Compact, Pdf417Dimensions}; use rxing::EncodingHintDictionary as Hint; use rxing::Writer; fn main(){ let ring = ring_code("test", 103, 270); save_file("test.jpg", &ring).unwrap(); } fn ring_code(contents: &str, width: i32, height: i32) -> BitMatrix { let writer = PDF417Writer::default(); let dimensions = Dimensions::new(2, 2, 70, 70); let mut hints = Hint::new(); hints.insert(ERROR_CORRECTION, ErrorCorrection("6".to_string())); hints.insert(PDF417_DIMENSIONS, Pdf417Dimensions(dimensions)); hints.insert(PDF417_COMPACT, Pdf417Compact("true".to_string())); hints.insert(MARGIN, Margin(("5").to_string())); writer .encode_with_hints(contents, &PDF_417, width, height, &hints) .unwrap() }
as you can see it have extra white space
Fixed by #34 fixed this issue
This fix appears in v0.4.6, currently uploading to cargo
my code
result
as you can see it have extra white space
it should be
34