Enum DotCodeEncodeMode
Contents
[
Hide
]DotCodeEncodeMode enumeration
Encoding mode for DotCode barcodes.
public enum DotCodeEncodeMode
Values
Name | Value | Description |
---|---|---|
Auto | 0 | Encode codetext with value set in the ECIEncoding property. |
Bytes | 1 | Encode codetext as plain bytes. If it detects any Unicode character, the character will be encoded as two bytes, lower byte first. |
ExtendedCodetext | 2 | Extended mode which supports multi ECI modes. |
Examples
[C#]
//Auto mode with macros
var codetext = ""[)>\u001E05\u001DCodetextWithMacros05\u001E\u0004"";
using (var generator = new BarcodeGenerator(EncodeTypes.DotCode, codetext))
{
generator.Save("test.bmp");
}
//Auto mode
var codetext = "犬Right狗";
using (var generator = new BarcodeGenerator(EncodeTypes.DotCode, codetext))
{
generator.Parameters.Barcode.DotCode.ECIEncoding = ECIEncodings.UTF8;
generator.Save("test.bmp");
}
//Bytes mode
byte[] encodedArr = { 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9 };
//encode array to string
StringBuilder strBld = new StringBuilder();
foreach (byte bval in encodedArr)
strBld.Append((char) bval);
var codetext = strBld.ToString();
using (var generator = new BarcodeGenerator(EncodeTypes.DotCode, codetext))
{
generator.Parameters.Barcode.DotCode.DotCodeEncodeMode = DotCodeEncodeMode.Bytes;
generator.Save("test.bmp");
}
//Extended codetext mode
//create codetext
DotCodeExtCodetextBuilder textBuilder = new DotCodeExtCodetextBuilder();
textBuilder.AddFNC1FormatIdentifier();
textBuilder.AddECICodetext(ECIEncodings.Win1251, "Will");
textBuilder.AddFNC1FormatIdentifier();
textBuilder.AddECICodetext(ECIEncodings.UTF8, "犬Right狗");
textBuilder.AddFNC3SymbolSeparator();
textBuilder.AddFNC1FormatIdentifier();
textBuilder.AddECICodetext(ECIEncodings.UTF16BE, "犬Power狗");
textBuilder.AddPlainCodetext("Plain text");
//generate codetext
string codetext = textBuilder.GetExtendedCodetext();
//generate
using(BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.DotCode, codetext))
{
generator.Parameters.Barcode.DotCode.DotCodeEncodeMode = DotCodeEncodeMode.ExtendedCodetext;
generator.Save("test.bmp");
}
See Also
- namespace Aspose.BarCode.Generation
- assembly Aspose.BarCode