Not able to scan generated QR Code using Aspose

Hi Team,

I am trying to generate QR code with maximum number of characters and facing following two problems:

  1. We have used following code to generate QR code for text with length 4430 characters :

==============================================================================

//Instantiate linear barcode object

var builder = new BarCodeBuilder { CodeText = QRCodeText, SymbologyType = Symbology.QR, CodeLocation = CodeLocation.None, AutoSize = true };

// Set the Margins

builder.Margins.Top = 1f;

builder.Margins.Bottom = 1f;

builder.Margins.Left = 1f;

builder.Margins.Right = 1f;

//Creating memory stream

var ms = new MemoryStream();

//Saving QR code image to memory stream

builder.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);

// Inserting QR code image in worksheet 2 - 37th row and Column'I' from memory stream

int pictureIndex = worksheet2.Pictures.Add(31, 7, 37, 9, ms);

Picture picture = worksheet2.Pictures[pictureIndex];

picture.Placement = PlacementType.Move;

==============================================================================
And getting exception while creating QR code with number of characters greater than some specified limit; i.e. 2953. The exception is : “Maximum characters limit reached for Binary encode mode and LevelL error correction level. Encoded data length - 4430. Max available length - 2953.”

Please refer attached document to see the exceptions, I am getting at my end(ExceptionDocument.docx ) and provide me the suggestion to create QR code with as much text as we want.

  1. If I have reduced the QR code text to 2953, then I am getting the QR code as in my pdf, which I am not able to scan. Please refer “QRCodeInOurDocument.png” to see the generated QR code using Aspose.

On other hand, I have tried generating QR code for same text using some other tool available on https://www.the-qrcode-generator.com/ and got attached QR Code, which I am able to scan. Please refer “QRCodeGenerator.png”.

Please let me know, why there is a difference between these two QR codes when I am generating both with same text and size, Or

Please suggest how can I achieve creating proper QR code using Aspose which can be scanned successfully.

Thanks in advance,

Preety

Hi Preety,


Thank you for contacting support.
prateekgupta:
Provide me the suggestion to create QR code with as much text as we want.
You are facing this error message because the maximum chars limit is 2953. I’ve logged a task to improve the maximum chars limit as BARCODENET-33819 in our issue tracking system. We’ll keep you updated regarding any updates. We’re sorry for your inconvenience.
prateekgupta:
If I have reduced the QR code text to 2953, then I am getting the QR code as in my pdf, which I am not able to scan. Please refer “QRCodeInOurDocument.png” to see the generated QR code using aspose.
Normally, we can generate/recognize QR codes with chars limit 2953. Anyway, I tested your sample barcode image (QRCodeInOurDocument.png) against the latest build of Aspose.BarCode 6.0.0. I’ve managed to replicate the problem of recognition failure. I have logged this problem under ticket id BARCODENET-33820 in our issue tracking system. Your request has also been linked to this issue and you will be notified as soon as it is possible. We’re sorry for your inconvenience.

Hi,

Thanks for your response.

Could you please let us know the estimated date when we can get the solution for the abovereported incidents.

BARCODENET-33819

BARCODENET-33820

Also let us know, how can we trach these incidents.

Why all other public online sites can generate a smaller QR , but it can't be genarated by Aspose.

Thanks

Hi Prateek,


Thank you for asking about the resolution. I’m sorry to share with you that these issues are not yet resolved. These are pending for analysis. I have asked the responsible developer to take a look at your issues shortly. As soon as any information is shared by him, I will be more than happy to share that with you.
prateekgupta:
Also let us know, how can we trach these incidents.
Unfortunately, there is no direct way you can track issues by yourself. But, you are welcome to ask your issue status via forum threads. We will verify the status from our internal issue tracking system and reply you back.
prateekgupta:
Why all other public online sites can generate a smaller QR , but it can’t be genarated by Aspose.
Well, you can control its size during the bar code generation process. The GetOnlyBarCodeImage method will return you the minimum possible size and then you can use GetCustomSizeBarCodeImage method to adjust its size. Please don’t truncate its original width or height otherwise you could face recognition failure problems.

Please refer to the documentation article here:

I hope, this helps.

Hi,

Thanks for your reply.

Please provide us the ETA for this issue.

Moreover, here my requirement is to display QR code with in specific size, not Bar code.

Thanks,

Prateek

Hi Prateek,


Thank you for your inquiry. I’m sorry to share with you that this issue is pending for analysis and not resolved yet. Our development team has plans to include the fix of issue ids BARCODENET-33819 and BARCODENET-33820 in our next release of Aspose.BarCode for .NET 6.2.0. It is expected to be released at the start May 2014. It’s all depend upon if everything goes by plans. We will let you know once the issue is resolved.

Based on your requirement, please note that you can adjust code size and location. Please refer to the helping topic here: Manage Caption of the Barcode

Furthermore, I noticed that you have an enterprise support level subscription which allows you to escalate these issues further to prioritize in the queue. If you want treated with priority, then please do let me know. I’ll increase the priority of these issues to the enterprise support.

Hi Prateek,

Thank you for being patient. We have a good news for you is BARCODENET-33819 has now been marked as resolved. If there is no issue in the QA phase, then its fix will be included in the next version of Aspose.BarCode for .NET 6.2.0. It is expected at the start of next month. We will inform you via this forum thread as soon as the new release is published.

The issues you have found earlier (filed as BARCODENET-33819) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi Preety,


Thank you for being patient.
prateekgupta:
If I have reduced the QR code text to 2953, then I am getting the QR code as in my pdf, which I am not able to scan. Please refer “QRCodeInOurDocument.png” to see the generated QR code using aspose.
Imran Rafique:
Normally, we can generate/recognize QR codes with chars limit 2953. Anyway, I tested your sample barcode image (QRCodeInOurDocument.png) against the latest build of Aspose.BarCode 6.0.0. I’ve managed to replicate the problem of recognition failure. I have logged this problem under ticket id BARCODENET-33820 in our issue tracking system. Your request has also been linked to this issue and you will be notified as soon as it is possible. We’re sorry for your inconvenience.
Our development team has gone through the analysis of this issue and found that the picture quality is quite bad. Can you please share the original picture before inserting it to the PDF file? Or the original PDF document. It will help us to be more specific.

Hi Team,

We have installed the .msi file provided by you and have checked with the dlls saved at location “C:\Program Files (x86)\Aspose\Aspose.BarCode for .NET\bin\net4”, but the same problem still exists. I am getting the same exception as reported earlier:

//Creating memory stream

var ms = new MemoryStream();

//Saving QR code image to memory stream

builder.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);

Exception is : “Maximum characters limit reached for Binary encode mode and LevelL error correction level. Encoded data length - 4430. Max available length - 2953.”

I have shared a sample application here (Please find attached Aspose Sample.zip) which will be generating the QR code, inserting the generated QR code in excel and converting this excel to pdf.

You will get the exception at above mentioned position in the code.

Please provide us the solution, so that -

  1. we can generate the QR code for the text of length more than 2953 chars.

  2. Also the generated QR code should be of specific size and be displayed in fixed area which can be scanable.

Note that we are using .NET framework 4.0.

Thanks in advance

Hi Preety,

Thank you for sharing the details. We have increased the QR code character encoding limit. You can try the source code below:

[C#]

string text = "";

for (int i = 0; i < 4296; i++)

{

text += "A";

}

using (BarCodeBuilder builder = new BarCodeBuilder(text, Symbology.QR))

{

Bitmap bitmap = builder.GetOnlyBarCodeImage();

using (BarCodeReader reader = new BarCodeReader(bitmap))

{

if (reader.Read())

{

Console.WriteLine(text == reader.GetCodeText());

}

}

}

Anyway, I’m able to notice this error message again with your sample code text. I’ve logged this issue under ticket id BARCODENET-33899 in our issue tracking system. We’ll keep you informed about any update. We’re sorry for your inconvenience.

Please note that you can control the barcode image size using the custom support. Please visit the documentation page here. The GetOnlyBarCodeImage method will allow you to get the exact bar code in the Bitmap format and then the GetCustomSizeBarCodeImage method will allow you to set the size of the whole picture with bar code inside. Please don’t truncate its original width or height otherwise you could face recognition failure problems.

I hope, it helps.

Hi Preety,


In addition to the above reply, please note that the issue id BARCODENET-33820 is not really about QR encoding. It is about QR code recognition from a PDF document. Since I asked about the original barcode image or PDF document.
prateekgupta:
2) If I have reduced the QR code text to 2953, then I am getting the QR code as in my pdf, which I am not able to scan. Please refer “QRCodeInOurDocument.png” to see the generated QR code using aspose.

Hi,

I have tested my sample application with the code provided by you to generate the QR code:

Bitmap bitmap = builder.GetOnlyBarCodeImage();

This line of code is giving exception at my end saying "Sorry, evaluation version does not allow to generate such type of barcode's image".

Hence I am not able to test it. Please find the attached screen shot(ExceptionInGetOnlyBarCodeImage.png).

Thanks in advance

Preety

Hi Preety,


Thank you for your inquiry. It is because you have not applied a valid license. You can avoid evaluation limitations by getting a temporary license for 30 days and try the latest version at your end. You can download a latest version of Aspose.BarCode from the download page:

You can learn all about how Aspose products are licensed by checking out the Licenses FAQ here: http://www.aspose.com/corporate/purchase/faqs/default.aspx

Please do let us know in case of any confusion or questions.

Thanks for you reply.

As mentioned by you, I have applied the license in my sample application and tried. This time I didnt get the exception I have reported earlier "Sorry, evaluation version does not allow to generate such type of barcode's image",

but getting the existing issue at the same line saying :

"Maximum characters limit reached for Binary encode mode and LevelL error correction level. Encoded data length - 4770. Max available length - 2953."

Please find the attached screen shot for the same.

This issue is still there and I am not able to generate the QR code for code text with number of characters greater than 2953 . Please provide the appropriate solution for the issues reported earlier.

Thanks,

Preety

Hi Preety,


Thank you for your inquiry. I would like to update you that the maximum available length of the text for QR code is 4296 symbols in Alphanumeric mode. Alphanumeric mode is for the decimal digits 0 through 9, as well as uppercase letters (not lowercase), and the symbols $, %, *, +, -, ., /, and : as well as a space. Other modes have less symbols. Please refer to the following page: http://en.wikipedia.org/wiki/QR_code#Storage

We have tested the latest version of Aspose.BarCode 6.2.0. It is generating QR code with 4296 symbols correctly. We can notice that you are generating a QR code with lower-case symbols, this is incorrect.

Please feel free to reply us in case of any other query or questions.

PS: The issue id BARCODENET-33899 has now been closed.

Hi Team,

This is regarding QR code recognition with the new dll provided by you.

Here I am generating QR code using new method provided by you 'GetOnlyBarCodeImage()' and inserting the QRcode in excel.

Bitmap bitmap = builder.GetOnlyBarCodeImage();
bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);

Further converting the same excel to pdf by saving the excel in pdf format.

var finalPdfFilePath = new WorkbookDesigner { Workbook = new Workbook(tempExcelFilePath) };
finalPdfFilePath.Workbook.Save(tempDestinationFilePath, SaveFormat.Pdf);

The issue is that, I am able to scan the QR code in Excel file attached, but not able to scan the QR code in pdf file; even they are exactly same.

Please find the attached excel files (QRCodeScanable.xls) and pdf (QRCodeNotScanable.pdf).

Please let me know the reason, why same QR code is scanable in one type of file (.xls) and not scanable in other type (.pdf)

Thanks,

Preety

Hi Preety,

Thank you for your inquiry. I’ve tested your sample PDF document against the latest builds of Aspose.PDF 9.2.1 and Aspose.BarCode 6.2.0. I can recognize the QR code as follows:

[C#]

// bind the pdf document

PdfExtractor pdfExtractor = new PdfExtractor();

pdfExtractor.BindPdf(@"C:\temp\QRCodeNotScanable.pdf");


pdfExtractor.ExtractImage();

int i = 0;

// save images to stream in a loop

while (pdfExtractor.HasNextImage())

{

Console.WriteLine("Getting image....");


i++;

// save image to stream

MemoryStream imageStream = new MemoryStream();


pdfExtractor.GetNextImage(imageStream, ImageFormat.Png);

using (BarCodeReader barcodeReader = new BarCodeReader(imageStream, BarCodeReadType.QR))

{

while (barcodeReader.Read())

{

Console.WriteLine(i + " Codetext found: " + barcodeReader.GetCodeText() + ", Symbology: " + barcodeReader.GetReadType().ToString());

}

}

}

Please let us know in case of any confusion or questions.

Hi Team,

I have reported the issue yesterday regarding recognition of generated QR code. The code provided by you is to read QR code specific to Aspose.

Please note we are using window/apple phones to scan the QR code.

I am attaching one pdf containing QR code, I am able to scan this QR code only once or twice out of 20 times. The scanning on this QR code is not consistent.

Please look into the issue.

Thanks,

Preety

Hi Preety,


Thank you for your inquiry. I’m afraid. I did not notice recognition failure problem on my side. Please share the environment details where it fails, i.e. Operating System, .NET Framework, application type (Reports Application etc.). It will be so nice of you if you can attach a sample project which reproduces the issue on your side and attach it here. Also, please share the exact sample code. We’ll investigate the issue at our end and guide you accordingly.