Aspose.Barcode for Python via Java Generation and Recognition API docs
MaxiCodeCodetextMode2 Class Reference

Class for encoding and decoding the text embedded in the MaxiCode code for modes 2. More...

Inherits MaxiCodeStructuredCodetext.

Public Member Functions

None __init__ (self)
 
Optional[MaxiCodeModemode (self)
 Gets MaxiCode mode. More...
 
- Public Member Functions inherited from MaxiCodeStructuredCodetext
None __init__ (self, _java_class)
 
bool __eq__ (self, MaxiCodeStructuredCodetext other)
 Returns a value indicating whether this instance is equal to a specified MaxiCodeStructuredCodetext value. More...
 
int __hash__ (self)
 Returns the hash code for this instance. More...
 
Optional[str] constructed_codetext (self)
 Constructs codetext. More...
 
int country_code (self)
 Identifies 3 digit country code. More...
 
None country_code (self, int value)
 Identifies 3 digit country code. More...
 
None init_from_string (self, str constructed_codetext)
 Initializes instance from constructed codetext. More...
 
Optional[str] postal_code (self)
 Identifies the postal code. More...
 
None postal_code (self, str value)
 Identifies the postal code. More...
 
Optional[MaxiCodeSecondMessagesecond_message (self)
 Identifies second message of the barcode. More...
 
None second_message (self, MaxiCodeSecondMessage value)
 Identifies second message of the barcode. More...
 
int service_category (self)
 Identifies 3 digit service category. More...
 
None service_category (self, int value)
 Identifies 3 digit service category. More...
 
- Public Member Functions inherited from MaxiCodeCodetext
EncodeTypes barcode_type (self)
 Gets barcode type. More...
 
ECIEncodings eci_encoding (self)
 Gets ECI encoding. More...
 
None eci_encoding (self, ECIEncodings value)
 Sets ECI encoding. More...
 
MaxiCodeEncodeMode encode_mode (self)
 
None encode_mode (self, MaxiCodeEncodeMode value)
 
MaxiCodeEncodeMode maxi_code_encode_mode (self)
 Gets a MaxiCode encode mode. More...
 
None maxi_code_encode_mode (self, MaxiCodeEncodeMode value)
 Sets a MaxiCode encode mode. More...
 

Additional Inherited Members

- Public Attributes inherited from MaxiCodeStructuredCodetext
 maxiCodeSecondMessage
 

Detailed Description

Class for encoding and decoding the text embedded in the MaxiCode code for modes 2.

 This sample shows how to encode and decode MaxiCode codetext for mode 2.

 \code
 maxi_code_codetext = MaxiCodeCodetextMode2()
 maxi_code_codetext.postal_code = "524032140"
 maxi_code_codetext.country_code = 056
 maxi_code_codetext.service_category = 999
 maxi_code_standard_second_message = MaxiCodeStandardSecondMessage()
 maxi_code_standard_second_message.message = "Test message"
 maxi_code_codetext.second_message = maxi_code_standard_second_message
 complex_generator = ComplexBarcodeGenerator(maxi_code_codetext)
 complex_generator.generate_barcode_image()

 \endcode
 \code

 maxi_code_codetext = MaxiCodeCodetextMode2()
 maxi_code_codetext.postal_code = "524032140"
 maxi_code_codetext.country_code = 056
 maxi_code_codetext.service_category = 999
 maxi_code_structured_second_message = MaxiCodeStructuredSecondMessage()
 maxi_code_structured_second_message.add("634 ALPHA DRIVE")
 maxi_code_structured_second_message.add("PITTSBURGH")
 maxi_code_structured_second_message.add("PA")
 maxi_code_structured_second_message.year = 99
 maxi_code_codetext.second_message = maxi_code_structured_second_message
 complex_generator = ComplexBarcodeGenerator(maxi_code_codetext)
 complex_generator.generate_barcode_image()

 \endcode
 \code

 reader = BarCodeReader(image_path, DecodeType.MAXI_CODE)
 for result in reader.read_barcodes():
    result_maxi_code_codetext = ComplexCodetextReader.try_decode_maxi_code(result.extended.maxi_code.maxi_code_mode, result.code_text())
    if result_maxi_code_codetext is MaxiCodeCodetextMode2:
        maxi_code_structured_codetext = result_maxi_code_codetext
        print("BarCode Type: " + maxi_code_structured_codetext.postal_code)
        print("MaxiCode mode: " + maxi_code_structured_codetext.country_code)
        print("BarCode CodeText: " + maxi_code_structured_codetext.service_category)
        if maxi_code_structured_codetext.second_message is MaxiCodeStandardsecond_message:
            second_message = maxi_code_structured_codetext.second_message
            print("Message: " + second_message.message)

 \endcode
 \code

reader = BarCodeReader(image_path, DecodeType.MAXI_CODE)
for result in reader.read_barcodes():
    result_maxi_code_codetext = ComplexCodetextReader.try_decode_maxi_code(result.extended.maxi_code.maxi_code_mode, result.code_text())
    if result_maxi_code_codetext is MaxiCodeCodetextMode2:
        maxi_code_structured_codetext = result_maxi_code_codetext
        print("BarCode Type: " + maxi_code_structured_codetext.postal_code)
        print("MaxiCode mode: " + maxi_code_structured_codetext.country_code)
        print("BarCode CodeText: " + maxi_code_structured_codetext.service_category)
        if maxi_code_structured_codetext.second_message is MaxiCodeStructuredSecondMessage:
            second_message = maxi_code_structured_codetext.second_message
            print("Message:")
            for identifier in second_message.identifiers:
                print(identifier)
 \endcode

Constructor & Destructor Documentation

◆ __init__()

None __init__ (   self)

Member Function Documentation

◆ mode()

Optional[MaxiCodeMode] mode (   self)

Gets MaxiCode mode.

Returns
: MaxiCode mode or None if not set.

Reimplemented from MaxiCodeCodetext.