PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Drawing a barcode

When you draw the barcode, you retrieve the resource in which the barcode is drawn. To draw a barcode, you can call the draw() of the renderer, or simply use the proxy method provided by Zend_Barcode.

Example 61. Drawing 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,
$imageResource Zend_Barcode::factory(
    
'code39''image'$barcodeOptions$rendererOptions
)->draw();

Example 62. Drawing a barcode with Zend_Barcode::draw()

<?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,
$imageResource Zend_Barcode::draw(
    
'code39''image'$barcodeOptions$rendererOptions
);

Zend Framework