source: trunk/xgraph/jpgraph/Examples/datamatrix_ex5.php

Last change on this file was 42, checked in by marrucho, 10 years ago
File size: 835 bytes
Line 
1<?php
2require_once('jpgraph/datamatrix/datamatrix.inc.php');
3
4$data = 'This is a 20x20 symbol';
5
6// Create and set parameters for the encoder
7$encoder = DatamatrixFactory::Create(DMAT_20x20);
8$encoder->SetEncoding(ENCODING_TEXT);
9
10// Create the image backend (default)
11$backend = DatamatrixBackendFactory::Create($encoder);
12
13// By default the module width is 2 pixel so we increase it a bit
14$backend->SetModuleWidth(4);
15
16// Set Quiet zone
17$backend->SetQuietZone(10);
18
19// Set other than default colors (one, zero, quiet zone/background)
20$backend->SetColor('navy','white','lightgray');
21
22// Create the barcode from the given data string and write to output file
23try {
24    $backend->Stroke($data);
25} catch (Exception $e) {
26    $errstr = $e->GetMessage();
27    echo "Datamatrix error message: $errstr\n";
28}
29
30?>
Note: See TracBrowser for help on using the repository browser.