Aspose.BarCode使用非英文字符編寫二維碼

在使用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")

發佈了15 篇原創文章 · 獲贊 1 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章