Search code examples
c#zxingzxing.net

IBarcodeWriter.Write is gone


I had function that was printing barcode fine:

public void drawQr(string val)
{

IBarcodeWriter writer = new BarcodeWriter
{
    Format = BarcodeFormat.QR_CODE,
    Options = new QrCodeEncodingOptions
    {
        Width = 60,
        Height = 60
    }
};

Bitmap  barcodeBitmap = writer.Write(val);
...

}

But currently I found that function Write is missing in IBarcodeWriter in new ZXing version.

What is simplest way to print barcode to Bitmap in new ZXing version?


Solution

  • The write method appears to be missing in the interface IBarcodeWriter, but it is still present in the implementation class BarcodeWriter.

    Try replacing the line

    IBarcodeWriter writer = new BarcodeWriter
    

    with either

    BarcodeWriter writer = new BarcodeWriter
    

    or

    var writer = new BarcodeWriter