Gerando QRCode diretamento com a classe Barcode

I used SfBarcode to generate and display QRCode, but because the text used is too long, it generated memory overflow (2 GB or more).
In the exception messages I discovered that the SfBarcode control uses the Syncfusion.Windows.Forms.Barcode.QRCode class; I removed the control and used the QRCode class directly.
Graphics in Windows have to be used with care, even more if you instantiate several objects to generate them and display them.
Here is an example:

using System;
using System.Windows.Forms;
using Syncfusion.Windows.Forms.Barcode;

public Image QRCodeImagem(string textoqrc)
{
    QRBarcode qrbc = new QRBarcode
    {
        ErrorCorrectionLevel = ErrorCorrectionLevel.Medium,
        InputMode = QRInputMode.BinaryMode,
        QRVersion = QRBarcodeVersion.Auto,
        XDimension = 8
     };
     qrbc.Text = textoqrc;
     return qrbc.Draw(0);
}

The Return as Image generated by the Draw () method, is perfect for inserting the QRCode image into any control as a PictureBox.

1 Reply

SP Sathya Ponnusamy Syncfusion Team October 12, 2017 12:13 PM UTC

  
Hi Sergio Ranzan, 

Thank you for your suggestion. 

Can you please share us the input text which you have used to convert into Barcode, so that it will be helpful for us to analyze in this further and fix it. 
  
Regards, 
Sathya Ponnusamy 


Loader.
Up arrow icon