Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15705

VS 2019 Barcode (QR) position detection

$
0
0
Hi

I need a way of getting the co-ordinates of a QR code on a pdf.

Here's a bit of background to this:


I have a bunch of pdfs with QR codes in various positions (they are positioned by another user, outside of my control).

I'm currently working out the area the QR manually, then using Ghostscript to convert the pdf to a png file showing just the QR code (ie I'm cropping to the graphic)

Once I've done this I'm using the ZXing.net library to decode the QR from the png file. I've found ZXing (and other libraries I've found) work best if I give them a graphic with just the QR on to look at, hence the crop.

This works fine, but I've now given the task of coming up with some way of batch processing a bunch of pdfs with placeholder QR codes (ie a bit of standard text, the same every time), and replacing this QR with a new one based on variable data.

Once I have the co-ords I can relate that back to the pdf, create the new barcode as a graphic, and finally use itextsharp to stamp it over the top of the placeholder one.


So the problem is getting the co-ordinates.

I've seen several libraries, such as ZXing.net, which can decode a QR but I haven't found anything that will tell me the co-ords.

My only idea is to come up with some code which reads the png file pixel by pixel and look for a pattern of black and white squares, and thus try to find the QR code that way.

This seems VERY long-winded and may be open to problems - eg it might be tricky to distinguish a QR code from simple black text on a white background. I wondered if a better way is know by anyone?

Thanks for reading - sorry it was a bit lengthy!

Viewing all articles
Browse latest Browse all 15705

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>