You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 29, 2019. It is now read-only.
Consider using barcoders to do actual bar-code generation instead of rolling my own solution, so I can focus on getting something up and running quickly and focus time on creating necessary bindings for other languages.
The text was updated successfully, but these errors were encountered:
externcrate barcoders;use barcoders::sym::code39::*;use barcoders::generators::image::*;use std::io::prelude::*;use std::io::BufWriter;use std::fs::File;use std::path::Path;let barcode = Code39::new("1ISTHELONELIESTNUMBER".to_owned()).unwrap();let png = Image::png(80);// You must specify the height in pixels.let encoded = barcode.encode();// Image generators return a Result<Vec<u8>, barcoders::error::Error) of encoded bytes.let bytes = png.generate(&encoded[..]).unwrap();// Which you can then save to disk.let file = File::create(&Path::new("my_barcode.png")).unwrap();letmut writer = BufWriter::new(file);
writer.write(&bytes[..]).unwrap();
And even supports SVG files as in:
externcrate barcoders;use barcoders::sym::code39::*;use barcoders::generators::svg::*;use std::io::prelude::*;use std::io::BufWriter;use std::fs::File;use std::path::Path;let barcode = Code39::new("56DFU4A777H".to_owned()).unwrap();let svg = SVG::new(200);// You must specify the height in pixels.let encoded = barcode.encode();let data:String = svg.generate(&encoded).unwrap();let file = File::create(&Path::new("my_barcode.svg")).unwrap();letmut writer = BufWriter::new(file);
writer.write(data.as_bytes()).unwrap();
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Consider using barcoders to do actual bar-code generation instead of rolling my own solution, so I can focus on getting something up and running quickly and focus time on creating necessary bindings for other languages.
The text was updated successfully, but these errors were encountered: