Class HanXinExtCodetextBuilder

HanXinExtCodetextBuilder class

Extended codetext generator for Han Xin Code for Extended Mode of HanXinEncodeMode

public class HanXinExtCodetextBuilder

Constructors

NameDescription
HanXinExtCodetextBuilder()The default constructor.

Methods

NameDescription
AddAuto(string)Adds codetext fragment in Auto mode
AddBinary(string)Adds codetext fragment in Binary mode
AddCommonChineseRegionOne(string)Adds codetext fragment in Common Chinese Region One mode
AddCommonChineseRegionTwo(string)Adds codetext fragment in Common Chinese Region Two mode
AddECI(string, int)Adds codetext fragment in ECI mode
AddGB18030FourByte(string)Adds codetext fragment in GB18030 Four Byte mode
AddGB18030TwoByte(string)Adds codetext fragment in GB18030 Two Byte mode
AddGS1(string)Adds codetext fragment in GS1 mode
AddNumeric(string)Adds codetext fragment in Numeric mode
AddText(string)Adds codetext fragment in Text mode
AddUnicode(string)Adds codetext fragment in Unicode mode
AddURI(string)Adds codetext fragment in URI mode
GetExtendedCodetext()Returns codetext from Extended mode codetext builder

Examples

[C#]
//Extended codetext mode
//create codetext
var codeTextBuilder = new HanXinExtCodetextBuilder();
codeTextBuilder.AddGB18030TwoByte("漄");
codeTextBuilder.AddGB18030FourByte("㐁");
codeTextBuilder.AddCommonChineseRegionOne("全");
codeTextBuilder.AddCommonChineseRegionTwo("螅");
codeTextBuilder.AddNumeric("123");
codeTextBuilder.AddText("qwe");
codeTextBuilder.AddUnicode("ıntəˈnæʃənəl");
codeTextBuilder.AddECI("ΑΒΓΔΕ", 9);
codeTextBuilder.AddAuto("abc");
codeTextBuilder.AddBinary("abc");
codeTextBuilder.AddURI(@"backslashes_should_be_doubled\000555:test");
codeTextBuilder.AddGS1(@"(01)03453120000011(17)191125(10)ABCD1234(21)10");

var expectedStr = @"漄㐁全螅123qweıntəˈnæʃənəlΑΒΓΔΕabcabcbackslashes_should_be_doubled\000555:test(01)03453120000011(17)191125(10)ABCD1234(21)10";

//generate codetext
var str = codeTextBuilder.GetExtendedCodetext();

//generate
using (var bg = new BarcodeGenerator(EncodeTypes.HanXin, str))
{
    bg.Parameters.Barcode.HanXin.HanXinEncodeMode = HanXinEncodeMode.Extended;
    var img = bg.GenerateBarCodeImage();
    using (var r = new BarCodeReader(img, DecodeType.HanXin))
     {
        var found = r.ReadBarCodes();
        Assert.AreEqual(1, found.Length);
        Assert.AreEqual(expectedStr, found[0].CodeText);
      }
}

See Also