QR Barcode image back to text - php

I've converted hello world to QR Barcode image but my question is about getting the text back.
I mean if I sent that image to my friend, then is there any way that my friend get it back to text without using mobile reader/barcode reader machine .etc. so is there any PHP function can do this?!
If not then is there any idea I can convert text to encoded image then with PHP function whatever! I can get it back to text?!

There are several web based QR decoders. Your friend can just upload the image and the service will tell her what the code says.
One of the most popular is ZXing - http://zxing.org/w/decode.jspx
There are also others at
http://www.onlinebarcodereader.com/
http://www.patrick-wied.at/static/qrgen/

I use the ZBar bar code reader on linux (there's also a Windows and an iPhone binary), which can scan them using any supported video in device or a number of file formats (e.g., directly from PDF). It's also useful if you want to script the QR code processing.
E.g.,
$ zbarimg http://i.stack.imgur.com/pQV0s.png
QR-Code:hello world

Related

saving PDFs for later manipulation in PHP

I have a PDF with some text in it that I would like to modify dynamically using PHP. This is being done already with another PDF, and what happens is that PHP simply replaces a token in the form %token% with another value pulled from a database. If you open that PDF in a text editor, you can find the %token% in plain text. But with this other PDF that I want to do the same thing with, if you open it in a text editor, there are no tokens in plaintext (even though I explicitly created one using Adobe Acrobat Pro). Obviously, the PDF's string content in this PDF is either encrypted, compressed, or both. What I want to know is how can I save a PDF so that the string content remains as plaintext such that PHP can manipulate it.
Please note, I do not want to dynamically create the whole PDF from scratch using some PHP library. I know that is something that can be done, but the PDF I am working with already exists and I just want to modify it slightly in the manner described.
For things like that I like to use the free command line tool PDFtk, which can compress / decompress PDFs and some nice thinks more. You may have a look at: https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
PS: I edit a special pdf calendar form from the internet. I decompress it and replace the awful pink color for the weekend with gray (Saturday) and blue for Sunday. Violet I use as small bar to mark vacation days.

Converting .pdf to .zpl

I need to convert .pdf -file to .zpl -label file for printing with zebra printers, but is this even possible?
The PDF comes in as a base64 encoded string, and somehow I need to output that as a .zpl -file.
I use PHP in my project, and I prefer the method in PHP, but basically any programming language is fine, as long as it gets the job done.
I was thinking about converting the PDF to image(which seems to be possible by quick googling), and then from image(PNG, JPG, etc.) to ZPL(which also seems to be ok by quick googling), but does anyone have any knowledge about this kind of operation or any insights before I start to do this? I'm on a tight schedule here, and I cannot afford any fruitless work.
Update 4.8.2016
I went the other way and created the ZPL from the scratch because it keeps our service faster than doing some conversions. So I don't have any more info on this than what the google already offers, if someone comes wondering about this same thing. PS. ZPL isn't that hard of a language. ;)
I had the some problem to solve: take a PDF file, convert it into ZPL code somehow and print it using a Zebra printer.
Thanks to stackoverflow and the ZPL Programming Guide, I learned about embedding bitmaps with the Graphic Field command (^GF).
Basically, you have to do these steps:
Render a PDF file as a bitmap
Make it monochrome
Convert the bitmap into ASCII hexadecimal (as defined by ZPL)
Compress the ASCII hexadecimal (otherwise our printers struggled with megabytes of bitmap data)
Put the data into this code template ^XA^GFA{some parameters and tons of bitmap data}^XZ
Our services were running on ASP.NET so I wrote a C# library to do just that. It wraps the native calls to Google's PDFium for rendering and returns a string with valid ZPL code for printing.
You could convert base64 encoded PDF files like that:
public static string GetZplCode(string pdfBase64, int page = 0, int dpi = 203)
{
return PDFtoZPL.Conversion.ConvertPdfPage(pdfBase64, page: page, dpi: dpi);
}
I hope this nuget package will prevent others from spending weeks in searching on how to make this ^GF command work.

How to do the barcode reader in the php?

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.

Barcode generation and decoding in PHP

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.

Problem in picture overlapping when I convert HTML page to PDF

I want to overlap pictures, but it is not working and I need some help.
Here's the link to the page I'd like to convert:
http://9m9.com/innovative/sample/two.html
I want to convert this page to a PDF. You can see the small image overlapping the bigger one.
This is the page where you can click on a link that will convert the page to PDF.
http://citysoftsolutions.com/eclients/virtualtour/view_property_images.php?pid=9&uid=67
As you can see the image is placed behind the big image.
I'm using this converter script: http://mpdf.bpm1.com/
When I printed it using PrimoPDF driver it came out just fine. Last image was easily laid over. So there must be a bug with the script you're using.
What do I suggest?
If you'd like to convert your pages to PDFs "on the fly" I suggest you either
contact script creator and inform them of a bug in the script
use a different script (I'd check out this question that can help you)
If you'd like to just provide PDFs of your page I suggest you install a PDF printer driver (like PrimoPDF that I'm using) and print those pages yourself and use those.
I'm not working for Nitro PDF Software company nor am I related to them in any way. So this is not me advertising their products/services.
On a sidenote
Something's telling me that what you'd actually like to do is to create a PDF flyer/promo material or something. If that's actually what you're after I suggest you do that using some software that's meant for such a job. Microsoft Office Word will do, but you'll better off using some other. If it's a one page leaflet you could use Adobe Illustrator or CorelDraw. But if it's going to be an actual multipage document use something like Word or Adobe InDesign.
Word is probably something you can easily master. So go with that one.

Categories