Do you need to generate barcodes or qr codes? This image can generate a lot of them.
100K+
This is a fork of https://github.com/padiazg/barcode-generator that fixes http port exposure from the docker container as well as adds optional environment variable support.
Do you need to generate barcodes or qr codes? This function can generate a lot of them.
This project uses bwip-js.
bwip-js is a translation to native JavaScript of the amazing code provided in Barcode Writer in Pure PostScript. The translated code can run on any modern browser or JavaScript-based server framework.
$ git clone https://github.com/padiazg/barcode-generator.git
$ cd barcode-generator
$ npm install
node express.js
# as a regular container
$ docker run -d -p 3000:3000 --name barcode-generator padiazg/barcode-generator
# as Docker service, can be scaled
$ docker service create --name barcode-generator --publish 3000:3000 padiazg/barcode-generator
$ docker build -t your_dockerhub_id/barcode-generator .
Parameters must be passed as query string:
Example:
# ean13, white background, 2px of padding, show text
$ curl "http://localhost:3000?bcid=ean13&text=123456789012&backgroundcolor=FFFFFF&paddingwidth=2&paddingheight=2&includetext" --output ean13.png
# QR code, white background, 2px of padding
$ curl "http://localhost:3000?bcid=qrcode&text=Hello+world!&backgroundcolor=FFFFFF&paddingwidth=2&paddingheight=2" --output qrcode.png
Specific from this project:
false.Specific from bwip-js
bcid: The requested code. required
Look here a reference of which codes can be generated.
Search the symbol you are interested in, go into the page (Ex: let´s say EAN-13 as example) and search the Encoder: value (ean13 in this example). This value is what we need pass as bcid's value.
text: The value to represent. required. Look at the reference to know what's the format for each symbol.
scaleX: The x-axis scaling factor. Must be an integer > 0. Default is 2.
scaleY: The y-axis scaling factor. Must be an integer > 0. Default is scaleX.
scale: Sets both the x-axis and y-axis scaling factors. Must be an integer > 0.
rotate: Allows rotating the image to one of the four orthogonal orientations. A string value. Must be one of:
paddingwidth: Sets the left and right padding (in points/pixels) around the rendered barcode. Rotates and scales with the image.
paddingheight: Sets the top and bottom padding (in points/pixels) around the rendered barcode. Rotates and scales with the image.
monochrome: Sets the human-readable text to render in monochrome. Boolean true or false. Default is false which renders 256-level gray-scale anti-aliased text.
There are more options specific from BWIPP, and they are documented in the BWIPP wiki. You need to consult there to determine what options are available for each barcode type.
Content type
Image
Digest
Size
27.7 MB
Last updated
over 7 years ago
docker pull padiazg/barcode-generator