Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4613502
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:33:36+00:00 2026-05-22T01:33:36+00:00

I want to generate a barcode and underneath a button so that the user

  • 0

I want to generate a barcode and underneath a button so that the user can just click it and then print. However I haven’t been able to do this so now I have this code:

$page = new Zend_Pdf();
$imageResource =  Zend_Barcode::draw('code39', 'image', $barcodeOptions, $rendererOptions);
imagejpeg($imageResource, 'barcode.jpg', 100); 
$img = Zend_Pdf_Image::imageWithPath('barcode.jpg'); 
    //echo $randomTxt;
    echo '<br/>';
    echo '<img src="'. base_url() .'/images/logo.png"/>';
    echo '<img src="'. $img .'"/>';

However I get the following error:

A PHP Error was encountered

Severity: 4096

Message: Object of class
Zend_Pdf_Resource_Image_Jpeg could not
be converted to string

Filename:
views/vista_codigoDeBarras.php

Line Number: 19

I have no idea how to accomplish what I need and it’s sort of urgent now =/ any idea how I can do it? I’m using Zend framework to generate de barcode within CodeIgniter

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:33:37+00:00Added an answer on May 22, 2026 at 1:33 am

    I’m a bit confused on what you’re trying to achieve, but Zend_Pdf_Image is made for adding images to PDF documents. Given your requirement:

    I want to generate a barcode and
    underneath a button so that the user
    can just click it and then print.

    There are a few ways you can accomplish this. First off is to create a php script that simply outputs a barcode image, and use that as the src attribute of the image:

    // 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();
    

    Source: http://framework.zend.com/manual/en/zend.barcode.creation.html

    The user can then just open the image in a new tab or download and print it.

    The other option is to offer them a PDF download, which is a bit more complicated than I can devote the time to providing sample code for, but this link explains how to generate PDFs using the Zend_PDF class:

    http://devzone.zend.com/article/2525

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.