Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read QR Code from scanned PDF

I'm trying to insert and read qrcode's from PDF files. To create/read qr codes from images i'm using zxing project and to manipulate the pdf i'm using Big Faceless PDF.

Everything works well if i create the QR Code, insert into my pdf, and then read the images from the pdf and convert the correct one to QR Code. However, if i try to to read images from a scanned document (with a qr code sticker attach to it), i cannot obtain the qr code image from the pdf (the only image i can get, using Big Faceless PDF, is the document it self).

Does anyone knows a Java library to search in pdf files for qr codes?

Thanks for you help

like image 405
João Simas Avatar asked Apr 04 '11 10:04

João Simas


People also ask

Can you read QR code from PDF file?

The QR code enclosed within the PDF file can be decoded to reveal the complete user-supplied data on the form. QR Codes are generated with error correction. So, as long as the QR codes are clearly captured, a near 100% accuracy in form-based data capture is achievable.

How do I make a QR code PDF viewable?

Create your own PDF QR Code in 3 easy steps.Click 'Create QR Code' -> Choose 'PDF QR' type. Upload your PDF or paste the URL to the file. Customize the look and design of the QR Code as you like. Click on Next—and you're done!

Can you access a QR code from a screenshot?

Install the Google Lens app on your phone and launch it open. Select the relevant folder having the QR Code image or screenshot. Click on the screenshot to be scanned. Google lens will scan the QR Code and a message will pop up over it.

How do I read a QR code on my iPhone PDF?

iPhone users can scan documents and QR codes on their device using the built-in Notes and Camera apps. To scan a document in the iPhone's Notes app, open a new or existing note, then tap the "+" icon in the menu bar to access the "Scan Documents" tool.


1 Answers

The only reliable way to do this is to convert the PDF page to a bitmap, then using something like zxing to scan the entire page for the barcode. Extracting the individual images that make up the page won't work on every document: the barcode may be created using graphics operations rather than as an embedded image (that's how we do it), or if you PDF was scanned from a paper source as you've described, it will usually be one big image.

Once you've got the PDF converted to a bitmap, ZXing should be able to do this, at least in theory. Naturally I'd recommend sticking with us for the conversion to bitmap ;-)

If ZXing is having trouble finding the code, make sure it has enough white-space around it - you need 4 clear modules on all sides, so for smaller codes it should be about 10% of the width of the code in whitespace around the code, to help it scan.

Cheers... Mike (CTO@BFO)

like image 158
Mike B Avatar answered Oct 16 '22 01:10

Mike B