Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 1.01 KB

README.md

File metadata and controls

47 lines (34 loc) · 1.01 KB

Description

tualo-barcode can be used to create barcode images as svg. There are no native depenencies needed.

Currently suppored are:

  • Code39
  • Datamatrix

Requirements

Installation

npm install tualo-barcode

How to Use

var http = require('http');
var Barcode = require('tualo-barcode').Barcode;

var server = http.createServer(function(req, res) {
	res.writeHead(200);
	var code_39_svg = (new Barcode({
		type: 'Code39',
		width: 300
	})).getSVG('tualo.de',true);

	var datamatrix_svg = (new Barcode({
		type: 'Datamatrix',
		fillColor: 'blue',
		strokeColor: 'darkblue',
		strokeWidth: 1,
		width: 'auto',
		height: 'auto'
	})).getSVG('http://tualo.de',true);
	
	res.end('<html><body style="background: white;">'+code_39_svg+'<br/><br/>'+datamatrix_svg+'</body></html>');
});

server.listen(parseInt(process.env.PORT) || 3000);
console.log("server listening on port %d …", server.address().port);