【问题标题】:IBarcodeWriter.Write is goneIBarcodeWriter.Write 消失了
【发布时间】:2020-08-23 11:28:53
【问题描述】:

我的功能可以很好地打印条形码:

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);
...

}

但目前我发现新ZXing版本的IBarcodeWriter中缺少Write函数。

在ZXing新版本中,将条码打印到Bitmap最简单的方法是什么?

【问题讨论】:

    标签: c# zxing zxing.net


    【解决方案1】:

    接口IBarcodeWriter中似乎缺少write方法,但它仍然存在于实现类BarcodeWriter中。

    换行试试

    IBarcodeWriter writer = new BarcodeWriter
    

    与任一

    BarcodeWriter writer = new BarcodeWriter
    

    var writer = new BarcodeWriter
    

    【讨论】:

      【解决方案2】:

      Write 方法已移至接口IBarcodeWriter<TOutput>。 TOutput 取决于目标平台和特定的 BarcodeWriter 实现。在您的情况下,您应该使用IBarcodeWriter<Bitmap> writer = new BarcodeWriter ...。还有其他具有不同输出类型的实现,例如实现IBarcodeWriter<SvgImage>BarcodeWriterSvg

      【讨论】:

        猜你喜欢
        • 2021-10-21
        • 2012-06-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-03-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多