Data Matrix
This is a software library that enables programs to write Data Matrix barcodes of the modern ECC200 variety.
Installation
def deps do
[
{:data_matrix, "~> 0.1.0"}
]
end
Rendering options
There are currently two formats available: :svg and :text.
SVG options
| Option name | Default value |
|---|---|
width | auto |
height | auto |
viewbox | false |
module_size | 5 |
color | "black" |
background | "white" |
Text options
| Option name | Default value |
|---|---|
zero | "0" |
one | "1" |
newline | "\n" |
separator | "" |
Example
data = "123456"
svg =
data
|> DataMatrix.encode()
|> DataMatrix.format(:svg, color: "#6e4a7e", background: "aliceblue", width: 200)
File.write!("square.svg", svg)
matrix = DataMatrix.encode("A1B2C3D4E5F6G7H8I9J0K1L2", quiet_zone: 2, type: :rectangle)
File.write("rectangular.svg", DataMatrix.format(matrix, :svg, module_size: 8))