barcode generator
Generate 1D and 2D barcodes
Supported 1D types
Supported 2D types
- QR Code (comming soon)
- DataMatrix (comming soon)
- PDF417 (comming soon)
Requirements
- A working installation of GraphicsMagick.
- node >= 0.10.0
Installing
npm install barcode
Usage
Set it up and specify your type and options. The following 3 are the only required ones.
var barcode = ;var code39 = ;
Next choose from the three methods below how you want to output your barcode.
Stream
Get a stream of the final image data. you can collect this and save out a new PNG (default type), pipe it elsewhere, or save it to a CDN.
code39;
File to disk
Save an image out to the file system, pretty simple. Just be sure to specify your outfile.
var outfile = pathcode39;
Base64 encoded img
src
Often times, barcodes are single use for a single print or whatever. With this method, we can create one on the fly and just send the base64 encoded image to the browser through the HTML.
code39;
Refactor
Much of the underlying code for the generation is being rewritten, however the API will remain the same. As a rule, anything new will have to be testable.
Things todo:
- Move all checksums and ECC to a module in lib/utils
- Use the new barcode generation class: Barcode2D.js
- Remove uses of Barcode1D and in-place image generation
- Create separate functions for generating sequences
In the future:
- Abstract drawing to be able to draw with
gm
or output html (bars with css or canvas)