Demonstration - PDF417
Capable of containing large amounts of data in a variety of characters.
Used mainly for identification cards, inventory, and transport.
Dimensions of this barcode can be set; also contains a truncated version.
'use strict';
var http = require('http');
var barcodeBakeryCommon = require('barcode-bakery-common');
var barcodeBakeryPdf417 = require('barcode-bakery-pdf417');
var Color = barcodeBakeryCommon.Color;
var Drawing = barcodeBakeryCommon.Drawing;
var Label = barcodeBakeryCommon.Label;
http.createServer(function (request, response) {
var colorFront = new Color(0, 0, 0);
var colorBack = new Color(255, 255, 255);
// Barcode Part
var code = new barcodeBakeryPdf417.Pdf417();
code.setScale(2); // Resolution
code.setForegroundColor(colorFront); // Color of bars
code.setBackgroundColor(colorBack); // Color of spaces
code.setErrorLevel(2);
code.setCompact(false);
code.setQuietZone(true);
code.parse('PDF417');
// Drawing Part
var drawing = new Drawing(code, colorBack);
drawing.toBuffer(Drawing.IMG_FORMAT_PNG, function (err, buffer) {
response.writeHead(200, { "Content-Type": "image/png" });
response.end(buffer);
});
}).listen(8124);