带有 UTF-8 字符的 itext DataMatrix 条形码

itext DataMatrix barcode with UTF-8 chars

需要在 itextsharp Data-Matrix 条形码上设置哪些属性才能将 UTF-8 字符传递到内容中?

var matrix = new BarcodeDatamatrix();
iTextSharp.text.Image img = null;

//matrix.Options = BarcodeDatamatrix.DM_ASCII;
matrix.Options = BarcodeDatamatrix.DM_AUTO;
//matrix.Options = BarcodeDatamatrix.DM_B256;
//matrix.Options = BarcodeDatamatrix.DM_TEXT;

matrix.Generate("!\"#$%&\'()*+,-./:;< => ?@[\]^_`{|}~¡¢£¤¥¦§¨©ª«¬ ®¯°±²³´µ¶·¸¹º»¼½¾¿0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ");

img = matrix.CreateImage();

此 c# 代码创建了条形码,但内容无效。我也尝试了其他列出的 matrix.Options

问题出在我使用的扫描仪上,而不是代码上。

@AlexeySubach 发布了一个有效的在线扫描仪示例。我在 Android 上使用的扫描仪不起作用。

最后我通过 Zxing 将应用程序切换到 Barcode Scanner,现在运行良好。

(我与这个应用程序和开发者没有任何关系)