When you render a barcode, you draw the barcode, you send the headers and you send the
resource (e.g. to a browser). To render a barcode, you can call the
render() method of the renderer or simply use the proxy method
provided by Zend_Barcode.
Example 62. Renderering a barcode with the renderer object
<?php
// Only the text to draw is required
$barcodeOptions = array('text' => 'ZEND-FRAMEWORK');
// No required options
$rendererOptions = array();
// Draw the barcode in a new image,
// send the headers and the image
Zend_Barcode::factory(
'code39', 'image', $barcodeOptions, $rendererOptions
)->render();
This will generate this barcode:
Example 63. Renderering a barcode with Zend_Barcode::render()
<?php
// Only the text to draw is required
$barcodeOptions = array('text' => 'ZEND-FRAMEWORK');
// No required options
$rendererOptions = array();
// Draw the barcode in a new image,
// send the headers and the image
Zend_Barcode::render(
'code39', 'image', $barcodeOptions, $rendererOptions
);
This will generate the same barcode as the previous example.




