Rev | Line | |
---|
[42] | 1 | <?php
|
---|
| 2 | require_once('jpgraph/datamatrix/datamatrix.inc.php');
|
---|
| 3 |
|
---|
| 4 | $data = 'This is a 64x64 datamatrix symbol';
|
---|
| 5 |
|
---|
| 6 | // Create and set parameters for the encoder
|
---|
| 7 | $encoder = DatamatrixFactory::Create(DMAT_64x64);
|
---|
| 8 | $encoder->SetEncoding(ENCODING_TEXT);
|
---|
| 9 |
|
---|
| 10 | // Create the image backend (default)
|
---|
| 11 | $backend = DatamatrixBackendFactory::Create($encoder);
|
---|
| 12 | $backend->SetModuleWidth(3);
|
---|
| 13 |
|
---|
| 14 | // Adjust the Quiet zone
|
---|
| 15 | $backend->SetQuietZone(10);
|
---|
| 16 |
|
---|
| 17 | // Create the barcode from the given data string and write to output file
|
---|
| 18 | try {
|
---|
| 19 | $backend->Stroke($data);
|
---|
| 20 | } catch (Exception $e) {
|
---|
| 21 | $errstr = $e->GetMessage();
|
---|
| 22 | echo "Datamatrix error message: $errstr\n";
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | ?>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.