/barcode-svg

A Node.js utility program for generating an SVG barcode.

Primary LanguageJavaScriptMIT LicenseMIT

barcode-svg

A Node.js utility program for generating an SVG barcode. Uses JsBarcode.

Installation

Clone or download and unzip, then in the directory run:

yarn

Or with npm:

npm install

Usage

Add an .env.local file with:

FORMAT="ean13"
CODE="123456789123"
# Optional
SUFFIX=">"
PATH="<destination-path>"

The default destination directory is the project root and the filename is a combination of the code and format.

Then run:

yarn start

Alternatively, you can use the following in bash:

FORMAT="ean13"; CODE="123456789123"; SUFFIX=">"; yarn start

A similar method can be used for other CLIs. You can also mix and match the above methods to set your own defaults.

Result:

Result SVG

Note:

  1. If the code is invalid for the format specified, an error will be shown.
  2. You can omit the checksum.