Démonstration - DataMatrix
Capable d'être lu par la plupart des téléphones portables.
Généralement utilisé sur les étiquettes pour la localisation d'items d'inventaire.
A un très bas taux de correction d'erreur.
Le code-barres peut être carré ou rectangulaire.
'use strict';
import { createServer } from 'http';
import { BCGColor, BCGDrawing } from '@barcode-bakery/barcode-common';
import { BCGdatamatrix } from '@barcode-bakery/barcode-datamatrix';
http.createServer(function (request, response) {
var colorBlack = new BCGColor(0, 0, 0);
var colorWhite = new BCGColor(255, 255, 255);
// Barcode Part
var code = new BCGdatamatrix();
code.setScale(2); // Resolution
code.setForegroundColor(colorBlack); // Color of bars
code.setBackgroundColor(colorWhite); // Color of spaces
code.parse('Datamatrix');
// Drawing Part
var drawing = new BCGDrawing(code, colorWhite);
drawing.toBuffer(BCGDrawing.ImageFormat.Png, function (err, buffer) {
response.writeHead(200, { "Content-Type": "image/png" });
response.end(buffer);
});
}).listen(8124);