1. Christopher Craft
  2. PowerBuilder
  3. Sunday, 16 April 2023 17:45 PM UTC

PowerBuilder 2022

I am working on a project where I am using EZTwain to scan documents, look for a barcode to get the routing information, save them as a PDF, then send them to the database as a blob.  I now need to support reading a QR code which EZTwain does not automatically support.  I have been looking at using the ZXing library to look for the barcode or QR code but I think the call to do it requires a bitmap image from the DIB.  This example code is really what I need to do in PB:

==========

// Get the image data as a Bitmap
Bitmap bmp = twain.GetImage(0);

// Decode the QR code using ZXing
BarcodeReader reader = new BarcodeReader();
reader.Options = new DecodingOptions
{
PossibleFormats = new List<BarcodeFormat> { BarcodeFormat.QR_CODE }
};
Result result = reader.Decode(bmp);

===========

I have been reading a lot about other developers trying to print a QR code (which I will need to do too) but nothing about trying to consume it.  EZTwain has a way to convert the DIB to a DIBSection which is a 'special kind of HBITMAP' but I have not been able to figure out if I can use that to pass to ZXing.

Anyway, if anyone has thoughts on this please chime in! I feel like I am spinning in circles so someone needs to knock me off my path a little.

Chris Craft

Christopher Craft Accepted Answer Pending Moderation
  1. Tuesday, 18 April 2023 00:09 AM UTC
  2. PowerBuilder
  3. # 1

Thanks Miguel,

I have been looking over these examples but I don't see where it has the option to read a qr code from either a file or from the scanned image (DIB)? Is it right in front of my eyes?

Also - I thought there was an option to read the QR code from a Base64 string but I am still at a loss as to how to transform the DIB to this. Any thoughts there?

Chris Craft

Comment
  1. Christopher Craft
  2. Tuesday, 18 April 2023 00:21 AM UTC
This is the example:



https://simplesolution.dev/java-read-qr-code-from-image-file-base64-zxing/#:~:text=In%20this%20step%20we%20implement%20a%20QRCodeReader%20class,argument%20and%20returns%20encoded%20text%20in%20QR%20Code.
  1. Helpful
  1. Miguel Leeuwe
  2. Tuesday, 18 April 2023 07:19 AM UTC
Hi,

I'm traveling, so I won't be able to try and help you out for a couple of days. Maybe if the weather isn't that great I can make some time :)
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Sunday, 16 April 2023 19:07 PM UTC
  2. PowerBuilder
  3. # 2

Hi,

Here's two links that work with the ZXing library. I created a C# DLL which I then imported into PB using the DLL import tool.

https://community.appeon.com/index.php/qna/q-a/qrcode-images-don-t-show-on-a-picture-control-depending-on-the-format

and Ramón might also have something here: https://community.appeon.com/index.php/qna/q-a/zxing-net#reply-28319

Regards.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.