mujaffars
mujaffars

Reputation: 1479

Barcode image generating in Zend 1.12 application

I am working on Barcode image generation in Zend 1.12 application.

I am following tutorial Example #5 Renderering a barcode with the renderer object

I have written below code in controller

function barcodeAction()
{
    $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();
}

While accessing barcode action -- Barcode image is not displaying

Below is the html I get from view source

<img style="-webkit-user-select: none" src="http://localhost/zend1.12/public/index/barcode">

Let me know what I am doing wrong

Upvotes: 1

Views: 216

Answers (1)

mujaffars
mujaffars

Reputation: 1479

I finally figured it out You need to disable the view -- So writing

$this->_helper->viewRenderer->setNoRender();

in action solved problem

Also noted that the text passed to barcode need to be UPPER case

$barcodeOptions = array('text' => 'ZEND-FRAMEWORK'); // This is valid

$barcodeOptions = array('text' => 'Zend-Framework'); // This is not valid

Upvotes: 1

Related Questions