I've built an e-shopping website for a big company which has country offices.
What i want to do is the following
Generate barcode via PHP before sending package to country offices of company
When the item will be arrived to country office, workers will login to their account, scan this barcode via barcode reader (which located on package) and website will automatically "approve" that item received.
Is it possible only with web interface? I mean without any local application. How to do that? PLease explain.
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.
A jQuery Barcode Generator: http://barcode-coder.com/en/barcode-online-generator-2.html
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 object
echo $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.
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.
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.
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.
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.
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.
Related
How to read the barcode by using the php
Steps done
I have generate the barcode by using the tcpdf scripts.
require_once(dirname(__FILE__).'/tcpdf_barcodes_1d_include.php');
// set the barcode content and type
$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128');
// output the barcode as SVG image
$barcodeobj->getBarcodeSVG(2, 30, 'black');
[http://www.tcpdf.org/examples/barcodes/example_1d_svg.svg]
But i don't know how to read the normal Barcode Image by using php.
And also i don't exactly what the barcode reader produces after scanning the barcode.But While surfing the sites i have seen that it will produce an output of 1-2-3-4 while scanning the barcode denoting the 1234. Please correct me if the output of the barcode reader differs from what i told
In cases like this. Don't you use a barcode scanner to scan the image and it handles the job of decoding? Only thing you have to do is save the code somewhere
When the code is scanned and given to the server, it will search for that code and thats how it goes.
This is the reason almost all libraries like this don't include a read/decode functionality.
I've built a ticketing system with PHP & MySQL that generates a barcode for each ticket. The current set up for scanning tickets is a simple web form and a USB barcode scanner. When a barcode is scanned, it submits the barcode's ID to the form and if it matches an ID in the database then the ticket is valid.
I'd now like to be able to scan tickets with a mobile device and am wondering which is the best route to go down. How I envisage it working is the the barcode (or QR code) will have a value like "9783546" and when it's scanned, it will point to a URL like http://www.myscanner.com/checkticket.php?id=9783546
(Perhaps this is not the best solution, if not please let me know.)
Another caveat is that I'd rather not hardcode the URL in to the qrcode itself, as it's liable to change.
I know there are QR code libraries for building scanners for iPhone and Android. Is there an advantage of using one over the other? Is pointing to the url like above the best way to handle this? Is there a prebuilt scanner that allows something like this already?
Apologies for the broad question, some points in the right direction would be greatly appreciated.
I was developing simular project. While researching i decided to stop on this library.
It is really easy for integrating with your project and it can handle many different types of barcodes.
You should check this library if it supports types of barcodes(QR codes) you needed.
And here you cand find example of integration zxing with android.
https://github.com/zxing/zxing/tree/master/android-integration/src/main/java/com/google/zxing/integration/android
But it is steel difficult to scan barcode very fast. You should aim on barcode and after 1-2 seconds it will be scanned. If you want to have fast scanner and if you want scanner to be able to scan barcodes at night time you should consider idea of buing additional device for scanning.
For example like this: http://ru.aliexpress.com/item/Mobile-Barcode-Scanner-for-Cell-Phones-of-Android-wp8-Bluetooth-portable-barcode-reader-data-collection-terminal/509789346.html
It can be easyliy integrated with you android devices through Bluetooth.
I have an requirement for library management system. In that i need bar code access for each entry of book. I don't have any idea about how to store that barcode acess in mysql.
when you use barcode scanner, it will type the scanned code(alpha and numeric) in any focused textbox, text area, word processing or any object in you computer that accepts numbers and letters.
lets say you have a barcode reader. And you have an active and focused TEXTBOX on your website. when you scan a barcode using a barcode reader/scanner, u will notice that it will automatically type the code in the TEXTBOX :)
thats how barcode works.
now to save the barcode, all u have to do is save the alphanumeric code in your database; its plain text :)
I need to develop a PHP application that will be generating barcodes and also will have the ability to read those barcodes back.
As my application will be a web based application and underlying technology is PHP which is a server side scripting language, I am feeling that barcode generation will not be an issue but the scanning and reading those barcodes may be a challenge.
Please guide me if its possible to read barcode in a PHP application.
Reading a barcode is usually easy, because barcode readers are usually the same as a normal keyboard, thus writing to the application as if it would be typed by the user. You just need to provide a text field on your page, where the data is entered. The user of course needs a barcode reader.
By adding [Enter] or [Tab] characters to the barcode, you can control to change to the next field or send the form to the server without additional user interaction.
Here is some links for your reference
http://www.ashberg.de/php-barcode/
http://www.phpclasses.org/package/2874-PHP-Recognize-text-objects-in-graphical-images.html
http://www.perkiset.org/forum/php/barcode_generator_using_php_and_gd-t2406.0.html
The trick to understanding bar code generation is to realize that a bar code is just an alternative way of writing characters. Some types of bar code have a limited set of characters they can represent (e.g. UPC is a fixed number (usually 13) of characters in the range 0-9)., others such as Code 3 of 9 have a wider range of characters (e.g. Code 3 of 9 is alpha numeric).
So the easiest way to generate bar codes is to use of one of the free Code 3 of 9 fonts, and use that to generate your bar code. You can either use the font in conjunction with the GD library to generate an image, or if you want to generate a PDF containing a bar code just incorporate the characters written in the bar code font directly into the PDF. You may even be able to get a bar code font from one of the web font services such as TypeKit or Google Web Fonts, and just put the bar code directly into the HTML page.
For reading back the bar codes, there's nothing in a normal web browser which will read a bar code and return just the characters. The user of your web app will need to upload an image containing the bar code which you can process on the server. The links that Miqdad Ali posted in his answer might help you do it server side.
I've read a couple of posts here on the site and as far as I understand it, using PHP to get and process the information obtained through a Barcode Scanner is possible, however I'd like to ask just to make sure, is it recommended? are there any caveats I should be aware of?
EDIT
I don't know the software of the barcode scanner since I haven't had access to it, however I described how it works on the comments down here. the barcode generates a fixed number of characters so I guess I could use a javascript event listener =)
I've noticed a lot of stores use online or LAN POS sites to handle purchases. Typically, the add an item page will set focus to a text field devoted to the product's barcode. When the scanner scans the barcode it's been preconfigured to output the code to wherever the cursor is (in this case, the barcode text field). Most system then have a JavaScript event listener on the field that submits the new item when a barcode is entered (the field reaches a certain length). Of course this is all theory. If you want sample code, please provide more specifics on the scanner and the software it came with.