Writing Barcodes

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am trying to write a page that creates some barcodes using the PEAR
Image_Barcode  module.  I am getting one barcode to write just fine
but it will not print out any more than one and will not print any
text on the page.

What I would like is to pass in the information to be barcoded, and a
category for each barcode, then have a page displayed that groups the
barcodes by category.

Category A
Product 1a barcode
product 2a barcode
product N barcode

Category B
Product 1b barcode
product 2b barcode


How do I get it so I can write HTML to the same page as my barcode?  I
am writing something very simple to play with this to start and only
one barcode is printing.


        $bc = new Image_Barcode;

        $bc->draw("BE1029", "Code39", "png");
        $bc->draw("BE1020", "Code39", "png");
        echo "hello"

ultimately, I would like something like

<tr><td>Category A</td><td>Category B</td><td>Category C</td></tr>
<tr><td>Product Barcode1a</td><td>Product Barcode 1b</td><td>Product
Barcode 1c</td></tr>

(obviously the code would contain php code for processing and looping,
i am just trying to give an idea of my goal)

Thanks very much for your help.

Re: Writing Barcodes

KDawg44 wrote:
Quoted text here. Click to load it
<----- SNIP -------->
Quoted text here. Click to load it
<----- SNIP -------->
Quoted text here. Click to load it

IMHO, because the class from PEAR actually putting out an image, it  
ultimately behaves as an image contenttype=image/png (or something like  

So in order to have 2 or more barcodes on your page, or text, you chould  
write another php (even html) that utilizes that your current barcode  

          $bc = new Image_Barcode;
          $bc->draw($_REQUEST['param1'], $_REQUEST['param2'], "png");

<!-- This is the first barcode -->
<img src="create-barcode.php?param1=BE1029&param2=Code39" />
<!-- This is the second barcode -->
<img src="create-barcode.php?param1=BE1020&param2=Code39" />
<!-- This is just text -->

PLEASE NOTE: That the script that i put there is just an example of how  
it can be done, without the consideration of other security measures.

Hendri Kurniawan

Re: Writing Barcodes

Quoted text here. Click to load it

Thanks very much!

Re: Writing Barcodes

Quoted text here. Click to load it

I don't know anything about PEAR but I seem to remember that www.fpdf.org
includes a php script for  outputting barcodes to PDF. It might be
worth a look.

Site Timeline