By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,733 Members | 907 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,733 IT Pros & Developers. It's quick & easy.

Writing Barcodes

P: n/a
Hi,

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

etc...

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.

<?php
require("Image/Barcode.php");

$bc = new Image_Barcode;

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

ultimately, I would like something like

<table>
<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>
etc....

(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.

May 1 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
KDawg44 wrote:
Hi,

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.
<----- SNIP -------->
>
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.

<?php
require("Image/Barcode.php");

$bc = new Image_Barcode;

$bc->draw("BE1029", "Code39", "png");
$bc->draw("BE1020", "Code39", "png");
echo "hello"
?>
<----- SNIP -------->
>
IMHO, because the class from PEAR actually putting out an image, it
ultimately behaves as an image contenttype=image/png (or something like
that).

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
script.

Example:
create-barcode.php
<?php
require("Image/Barcode.php");
$bc = new Image_Barcode;
$bc->draw($_REQUEST['param1'], $_REQUEST['param2'], "png");
?>
index.html
<html>
<!-- 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 -->
Hello
</html>
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
May 1 '07 #2

P: n/a
On May 1, 5:37 pm, Hendri Kurniawan <ask...@email.comwrote:
KDawg44 wrote:
Hi,
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.

<----- SNIP -------->
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.
<?php
require("Image/Barcode.php");
$bc = new Image_Barcode;
$bc->draw("BE1029", "Code39", "png");
$bc->draw("BE1020", "Code39", "png");
echo "hello"
?>

<----- SNIP -------->

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

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
script.

Example:
create-barcode.php
<?php
require("Image/Barcode.php");
$bc = new Image_Barcode;
$bc->draw($_REQUEST['param1'], $_REQUEST['param2'], "png");
?>

index.html
<html>
<!-- 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 -->
Hello
</html>

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
Thanks very much!

May 2 '07 #3

P: n/a
On May 2, 1:38 pm, KDawg44 <KDaw...@gmail.comwrote:
On May 1, 5:37 pm, Hendri Kurniawan <ask...@email.comwrote:
KDawg44 wrote:
Hi,
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.
<----- SNIP -------->
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.
<?php
require("Image/Barcode.php");
$bc = new Image_Barcode;
$bc->draw("BE1029", "Code39", "png");
$bc->draw("BE1020", "Code39", "png");
echo "hello"
?>
<----- SNIP -------->
IMHO, because the class from PEAR actually putting out an image, it
ultimately behaves as an image contenttype=image/png (or something like
that).
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
script.
Example:
create-barcode.php
<?php
require("Image/Barcode.php");
$bc = new Image_Barcode;
$bc->draw($_REQUEST['param1'], $_REQUEST['param2'], "png");
?>
index.html
<html>
<!-- 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 -->
Hello
</html>
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

Thanks very much!
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.

May 2 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.