'' 不是 3 of 9 标准条码的有效代码

'' is not a valid code for a 3 of 9 standard bar code

我想使用 .NET PDFSharp 库生成条形码。我正在创建条形码实例

BarCode barcode = new Code3of9Standard
{
    Text = content, // example: 'this text will be converted to a barcode'
    StartChar = '*',
    EndChar = '*',
    Size = (XSize)(new XPoint(120, 20)), // for testing purposes
};

但不幸的是实例创建抛出了这个异常

'' is not a valid code for a 3 of 9 standard bar code.

我也试过设置一个Code属性但是没有。构造函数提供了一些重载,所以我尝试了这个

BarCode barcode = new Code3of9Standard(content, (XSize)(new XPoint(120, 20)));

但是我得到了错误

'this text will be converted to a barcode' is not a valid code for a 3 of 9 standard bar code.

我从这里拿了例子

https://csharp.hotexamples.com/en/examples/PdfSharp.Drawing.BarCodes/Code3of9Standard/-/php-code3of9standard-class-examples.html

有人知道如何正确设置条形码实例以便我可以将其用于绘图功能

graphics.DrawBarCode(barcode, Brush, TopLeftOffset);

来自Code 39 Barcode FAQ & Tutorial

The symbology of the Code 39 character set consists of barcode symbols representing numbers 0-9, upper-case letters A-Z, the space character and the following symbols: – . $ / + %. Lower-case characters may also be easily encoded with the extended fonts provided in the IDAutomation Code-39 Font Package.

如果不购买 IDAutomation Code-39 Font Package,您将不得不坚持使用大写字母 (A-Z)、didits (0-9) 和一些符号 (–.$/+%)。

None 您链接的示例使用小写字母。