datamatrix-svg
datamatrix-svg copied to clipboard
Data Matrix generator is for fast creation of rectangular or square 2D codes. Written on vanilla javascript with no dependencies.
Data Matrix svg generator 
Data Matrix generator written on pure javascript. Produces highly optimized SVG nodes.
Data Matrix svg generator (Live demo)
Easy to start
After datamatrix.min.js
is downloaded and connected to your html5 page, call:
var
svgNode = DATAMatrix('Hello World!');
All other options:
var
svgNode = DATAMatrix({
msg : "Your message here"
,dim : 256
,rct : 0
,pad : 2
,pal : ["#000000", "#f2f4f8"]
,vrb : 0
});
Options
-
msg - Data Matrix
message
, obviously, this is mandatory parameter. -
rct - set 1 to render rectangle Data Matrix if possible, default value is
0
. -
dim - is equal to needed dimention (height) in pixels, default value is
256
. -
pad - white space padding, default value is
2
blocks, set0
for no padding. -
pal - is array of [
color
,background-color
] strings that represent hex color codes, default value is ['#000'
] along with transparent background. Set ['#000'
,'#fff'
] to make background opaque. -
vrb - svg node is optimized to be compact and default value is
0
, set this parameter to1
in case you need more verbose output.