Class MaxiCodeCodetextMode3
Contents
[
Hide
]MaxiCodeCodetextMode3 class
Class for encoding and decoding the text embedded in the MaxiCode code for modes 3.
public class MaxiCodeCodetextMode3 : MaxiCodeStructuredCodetext
Constructors
Name | Description |
---|---|
MaxiCodeCodetextMode3() | The default constructor. |
Properties
Name | Description |
---|---|
CountryCode { get; set; } | Identifies 3 digit country code. |
ECIEncoding { get; set; } | Gets or sets ECI encoding. Used when MaxiCodeEncodeMode is Auto. Default value: ISO-8859-1 |
MaxiCodeEncodeMode { get; set; } | Gets or sets a MaxiCode encode mode. Default value: Auto. |
PostalCode { get; set; } | Identifies the postal code. Must be 9 digits in mode 2 or 6 alphanumeric symbols in mode 3. |
SecondMessage { get; set; } | Identifies second message of the barcode. |
ServiceCategory { get; set; } | Identifies 3 digit service category. |
Methods
Name | Description |
---|---|
override Equals(object) | Returns a value indicating whether this instance is equal to a specified MaxiCodeStructuredCodetext value. |
GetBarcodeType() | Gets barcode type. |
override GetConstructedCodetext() | Constructs codetext |
override GetHashCode() | Returns the hash code for this instance. |
override GetMode() | Gets MaxiCode mode. |
override InitFromString(string) | Initializes instance from constructed codetext. |
Examples
This sample shows how to encode and decode MaxiCode codetext for mode 3.
[C#]
//Mode 3 with standart second message
MaxiCodeCodetextMode3 maxiCodeCodetext = new MaxiCodeCodetextMode3();
maxiCodeCodetext.PostalCode = "B1050";
maxiCodeCodetext.CountryCode = 056;
maxiCodeCodetext.ServiceCategory = 999;
MaxiCodeStandartSecondMessage maxiCodeStandartSecondMessage = new MaxiCodeStandartSecondMessage();
maxiCodeStandartSecondMessage.Message = "Test message";
maxiCodeCodetext.SecondMessage = maxiCodeStandartSecondMessage;
using (ComplexBarcodeGenerator complexGenerator = new ComplexBarcodeGenerator(maxiCodeCodetext))
{
complexGenerator.GenerateBarCodeImage();
}
//Mode 3 with structured second message
MaxiCodeCodetextMode3 maxiCodeCodetext = new MaxiCodeCodetextMode3();
maxiCodeCodetext.PostalCode = "B1050";
maxiCodeCodetext.CountryCode = 056;
maxiCodeCodetext.ServiceCategory = 999;
MaxiCodeStructuredSecondMessage maxiCodeStructuredSecondMessage = new MaxiCodeStructuredSecondMessage();
maxiCodeStructuredSecondMessage.Add("634 ALPHA DRIVE");
maxiCodeStructuredSecondMessage.Add("PITTSBURGH");
maxiCodeStructuredSecondMessage.Add("PA");
maxiCodeStructuredSecondMessage.Year = 99;
maxiCodeCodetext.SecondMessage = maxiCodeStructuredSecondMessage;
using (ComplexBarcodeGenerator complexGenerator = new ComplexBarcodeGenerator(maxiCodeCodetext))
{
complexGenerator.GenerateBarCodeImage();
}
//Decoding raw codetext with standart second message
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.MaxiCode))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
MaxiCodeCodetext resultMaxiCodeCodetext = ComplexCodetextReader.TryDecodeMaxiCode(result.Extended.MaxiCode.MaxiCodeMode, result.CodeText);
if (resultMaxiCodeCodetext is MaxiCodeCodetextMode3){
MaxiCodeCodetextMode3 maxiCodeStructuredCodetext = (MaxiCodeCodetextMode3)resultMaxiCodeCodetext;
Console.WriteLine("BarCode Type: " + maxiCodeStructuredCodetext.PostalCode);
Console.WriteLine("MaxiCode mode: " + maxiCodeStructuredCodetext.CountryCode);
Console.WriteLine("BarCode CodeText: " + maxiCodeStructuredCodetext.ServiceCategory);
if (maxiCodeStructuredCodetext.SecondMessage is MaxiCodeStandartSecondMessage){
MaxiCodeStandartSecondMessage secondMessage = (MaxiCodeStandartSecondMessage)maxiCodeStructuredCodetext.SecondMessage;
Console.WriteLine("Message: " + secondMessage.Message);
}
}
}
}
//Decoding raw codetext with structured second message
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.MaxiCode))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
MaxiCodeCodetext resultMaxiCodeCodetext = ComplexCodetextReader.TryDecodeMaxiCode(result.Extended.MaxiCode.MaxiCodeMode, result.CodeText);
if (resultMaxiCodeCodetext is MaxiCodeCodetextMode3){
MaxiCodeCodetextMode3 maxiCodeStructuredCodetext = (MaxiCodeCodetextMode3)resultMaxiCodeCodetext;
Console.WriteLine("BarCode Type: " + maxiCodeStructuredCodetext.PostalCode);
Console.WriteLine("MaxiCode mode: " + maxiCodeStructuredCodetext.CountryCode);
Console.WriteLine("BarCode CodeText: " + maxiCodeStructuredCodetext.ServiceCategory);
if (maxiCodeStructuredCodetext.SecondMessage is MaxiCodeStructuredSecondMessage){
MaxiCodeStructuredSecondMessage secondMessage = (MaxiCodeStructuredSecondMessage)maxiCodeStructuredCodetext.SecondMessage;
Console.WriteLine("Message:");
foreach (var identifier in secondMessage.Identifiers){
Console.WriteLine(identifier);
}
}
}
}
}
See Also
- class MaxiCodeStructuredCodetext
- namespace Aspose.BarCode.ComplexBarcode
- assembly Aspose.BarCode