back to index


Sun Jan 18 2004, 1:09 AM


Easy output of barcode images in webpages, with size specified in the IMG tag or its CSS definition.


GNU-Barcode with this patch, installed at /usr/local/bin/barcode. (Can be easily rewritten to use a shell wrapper that greps the output from the postscript output of the unpatched version.)

This version also needs PHP with GD patched for GIF support, GD-with-GIF. It's easy to rewrite it for PNG, though - just replace image/gif in the header() call with image/png, and replace imageGIF() with imagePNG(); both changes are at the very end of the code. GIF was chosen for its wide client-side compatibility and general suitability for this kind of task.


<IMG SRC="/barcode/barcode.php?TYPE=code128&DATA=This+is+a+test" STYLE="width:80mm;height:10mm">


barcode.php (saved as .txt for easier download)

See also:

List of barcodes and their uses - a vendor of it-does-everything barcode generator - for 2D barcodes this thing doesn't support yet
KBarCode - a Linux/KDE front-end for barcode printing
PDF417 generator for Linux (SourceForge)

If you have any comments or questions about the topic, please let me know here:
Your name:
Your email:
Leave this empty!
Only spambots enter stuff here.