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';
import { createServer } from 'http';
import { BCGColor, BCGDrawing, createSurface, toBuffer } from '@barcode-bakery/barcode-nodejs';
import { BCGpdf417 } from '@barcode-bakery/barcode-nodejs/pdf417';
http.createServer(function (request, response) {
const colorBlack = new BCGColor(0, 0, 0);
const colorWhite = new BCGColor(255, 255, 255);
// Barcode Part
const code = new BCGpdf417();
code.setScale(2); // Resolution
code.setForegroundColor(colorBlack); // Color of bars
code.setBackgroundColor(colorWhite); // Color of spaces
code.setErrorLevel(2);
code.setCompact(false);
code.setQuietZone(true);
code.parse('PDF417');
// Drawing Part
const drawing = new BCGDrawing(createSurface);
toBuffer(drawing, BCGDrawing.ImageFormat.Png, function (err, buffer) {
response.writeHead(200, { "Content-Type": "image/png" });
response.end(buffer);
});
}).listen(8124);