在使用Aspose.BarCode時,可以使用非英語字符集生成2維碼,例如,土耳文、中文、阿拉伯語、拉丁文、希臘文等等。字符數的限制是1000。下面是分別使用土耳其文和中文生成二維碼的實例:
使用土耳其字符創建一個Pdf417二維碼
C#
// Generate the barcode
BarCodeBuilder builder = new BarCodeBuilder();
// Set symbology type
builder.SymbologyType = Symbology.Pdf417;
// Set the code text
string codetext = "AYŞE" + "\n" + "Ümit" + "\n" + "Ü[email protected]" + "\n" + "Türkiye";
builder.CodeText = codetext;
// Set the display text
builder.DisplayText = codetext;
builder.Save("c:\\barcode.png");
VB.NET
' Generate the barcode
Dim builder As New BarCodeBuilder()
' Set symbology type
builder.SymbologyType = Symbology.Pdf417
' Set the code text
Dim codetext As String = "AYŞE" + vbLf + "Ümit" + vbLf + "Ü[email protected]" + vbLf + "Türkiye"
builder.CodeText = codetext
' Set the display text
builder.DisplayText = codetext
builder.Save("c:\\barcode.png")
使用漢語創建一個Pdf417二維碼
C#
// Generate the barcode
BarCodeBuilder builder = new BarCodeBuilder();
// Set symbology type
builder.SymbologyType = Symbology.Pdf417;
// Set the code text
string codetext = "被洪水困住的";
builder.CodeText = codetext;
// Set the display text
builder.DisplayText = codetext;
builder.Save("c:\\barcode.png");
VB.NET
' Generate the barcode
Dim builder As New BarCodeBuilder()
' Set symbology type
builder.SymbologyType = Symbology.Pdf417
' Set the code text
Dim codetext As String = "被洪水困住的"
builder.CodeText = codetext
' Set the display text
builder.DisplayText = codetext
builder.Save("c:\\barcode.png")