Reputation: 3679
I've built an e-shopping website for a big company which has country offices.
What i want to do is the following
Is it possible only with web interface? I mean without any local application. How to do that? PLease explain.
Upvotes: 26
Views: 64573
Reputation: 407
Important note about TCPDF library:
A new version of this library is under development at https://github.com/tecnickcom/tc-lib-pdf and as a consequence this version will not receive any additional development or support. This version should be considered obsolete, new projects should use the new version as soon it will become stable.
For generating linear and bidimensional barcodes there is separate library: https://github.com/tecnickcom/tc-lib-barcode
To generate barcode using the tc-lib-barcode library:
$bobj = $barcode->getBarcodeObj('CODABAR', '123456', -3, -30, 'black', array(0, 0, 0, 0));
// output the barcode as HTML div (see other output formats in the documentation and examples)
echo $bobj->getHtmlDiv();
echo "</br>";
//Output as png image
echo "<p><img alt=\"Embedded Image\" src=\"data:image/png;base64,".base64_encode($bobj->getPngData())."\" /></p>";
//Save image to folder
$destination_folder = "uploads/barcode.png";
file_put_contents($destination_folder, $bobj->getPngData());
Note:- I have used 'CODABAR' as barcode type. You can change the type of barcode/QR-code according to your needs.
Upvotes: 0
Reputation: 4007
First, you need to chose which barcode type you want to generate. There are multiple to consider, 1D or 2D. 1D barcodes are simple encode only a small amount of data. 2D barcodes are bigger and can encode more data, they are also a little more aesthetic :) If you go for a 2D barcodes, I would recommend QRCode, or DataMatrix. The PDF417 is a viable option if you need to lay your data more horizontally instead of squared. You can find more information here: http://www.barcodebakery.com/en/resources/guide/php/choosing-barcodes
Once you found your code to write, you consider which reader to get. I currently own a Metrologic Focus FirstFlash MS1690. It reads all the barcodes mentioned above. They are multiple options here again, the easiest is to get a USB barcode reader: when you scan a barcode, it would simply write it to the screen as someone were typing it on the keyboard.
Upvotes: 1
Reputation: 13725
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 object
echo $barcodeobj->getBarcodeHTML(2, 30, 'black');
Upvotes: 6
Reputation: 66
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.
Upvotes: 2
Reputation: 1
This is possible to make using php only. For this you need to take any ready php class to generate qr-code or barcode. Generating barcode may be performed with means of just selecting appropriate bacode font, so, instead of writting numbers php will be writing by barcoded digits. Reading of barcode was described above.
Upvotes: 0
Reputation: 33627
I'm looking at Zend barcode to do something similar, but admittedly I'm only getting started. I'm eager to know how others handle this.
Upvotes: 0
Reputation: 14625
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.
Upvotes: 27
Reputation: 20446
I'm not sure if I completely understand your question, but if you are looking make a file that can be printed as a barcode, you'll need to know what kind of files your barcode printer can print.
And if you are looking to read a barcode with a scanner into a webform, the scanner needs to recognize the barcode type. The scanner inputs the barcode value into the webform (or any other program that accepts text). The webform has nothing to do with recognizing a barcode.
Upvotes: 0