source: trunk/xgraph/jpgraph/Examples/datamatrix_ex7.php @ 42

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 573 bytes
Line 
1<?php
2require_once('jpgraph/datamatrix/datamatrix.inc.php');
3
4$data = 'A Datamatrix barcode';
5
6// Create and set parameters for the encoder
7$encoder = DatamatrixFactory::Create();
8$encoder->SetEncoding(ENCODING_BASE256);
9
10// Create the image backend (default)
11$backend = DatamatrixBackendFactory::Create($encoder, BACKEND_ASCII);
12$backend->SetModuleWidth(3);
13
14try {
15    $ps_txt = $backend->Stroke($data);
16    echo '<pre>'.$ps_txt.'</pre>';
17} catch (Exception $e) {
18    $errstr = $e->GetMessage();
19    echo "Datamatrix error message: $errstr\n";
20}
21
22?>
Note: See TracBrowser for help on using the repository browser.