Generating and reading barcode Generating and reading barcode php php

Generating and reading barcode


so here is an approach that could work for you:

You need to put a record in a database like:

package_id |    name      |   status  1234        My Package      shipped

Generate a barcode which contains the package_id, you have to decide what kind of barcode you want to use. You could also use a data matrix. Then you create the bar code as image so that you can print it. Data Matrix is very good for large custom data.

Print the bar code, put it on your package

The package arrives at the office, the user logs on to your website, clicks on "Confirm Package Received" or whatever. Then there is a text-field, he focuses the text-field, scans the barcode/data matrix and your package ID "1234" will appear in the text-field

Submit the form, lookup the entry in the database, change it to:

 package_id |     name      |   status  1234         My Package      delivered

A Tip If you use a QR Code it can be read by many mobile phones, so you don't need a real bar code scanner. You could write an app that reads the bar code and sends the package_id to your server.


Tcpdf has a few classes for generating barcodes:

http://www.tcpdf.org/doc/code/classTCPDFBarcode.html

With good examples:

http://www.tcpdf.org/examples.php

For example the first:

// set the barcode content and type$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128');// output the barcode as HTML objectecho $barcodeobj->getBarcodeHTML(2, 30, 'black');


Check larsjung.de/qrcode/

It's JQuery Pluggin, but works well with PHP.

As I see your scenario, you need more than just 1D Barcode. You need QR Code.

Hope this helps.