ZXing.NET "No encoder available for format" 异常

ZXing.NET "No encoder available for format" exception

我正在使用 ZXing.net 来支持从 Web 服务提供值的条形码编码。我有以下功能,当与 BarcodeFormat 枚举中发现的大多数可识别编码格式一起使用时,它工作得很好。但是,其中七个代码(ALL_1D、IMB、MAXICODE、MSI、RSS_14、RSS_EXPANDED、UPC_EAN_EXTENSION)导致 "No encoder available for format" 异常。

这是预期的结果吗?即,这些格式还不被支持吗?如果它们尚未实现,它们似乎不会被识别(在枚举中找不到)。

public static Bitmap EncodeValueBarcode(string text, BarcodeFormat format, int height)
{
    Bitmap bmp = null;

    var writer = new BarcodeWriter
    {
        Format = format,
        Options = new ZXing.Common.EncodingOptions()
    };
    if (height > 0)
        writer.Options.Height = height;
    if (width > 0)
        writer.Options.Width = width;

    bmp = writer.Write(text);

    return bmp;
}

枚举BarcodeFormat用于编码和解码。它包含至少由两者之一支持的每种格式。您得到的错误意味着它所说的:没有编码器支持该特定格式。并非每种可以解码的格式都有已实现的编码器。