Barcode.js
⚠️ Currently not ready for production usage!
Although we use this in production, we do so in a controlled environment usage only text sources we completely control.
Expect APIs to change until this notice is removed. (We will however respect semantic versioning.)
Encode strings into an intermediate representation and render them to different output formats.
The primary focus of this project is to be fast and have a low footprint, while being reliable.
Usage
Install via yarn
$ yarn add barcodejs
Or install via npm
$ npm install --save barcodejs
Create an SVG barcode
import {encodeCode39, renderBarcodeToSVG} from "barcodejs"
const svg = renderBarcodeToSVG(encodeCode39("HELLO WORLD"), {
width: "100%",
height: "20mm",
})
console.log(svg)
Support
Supported barcode types:
Supported output formats:
Features
- No dependencies
- The SVG is resizable via standard css or html
width
/ height
attributes (including % of the container).
Caveats
- Currently work in progress
- No validation of input strings
- Limited barcode type support
- No documentation 🙄