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

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

Inherits MaxiCodeStructuredCodetext.

Public Member Functions

None __init__ (self)
 
Optional[MaxiCodeMode] mode (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 3.

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

maxi_code_codetext = MaxiCodeCodetextMode3()
maxi_code_codetext.postal_code = "B1050"
maxi_code_codetext.country_code = 56
maxi_code_codetext.service_category = 999
standard_second_message = MaxiCodeStandardSecondMessage()
standard_second_message.message = "Test message"
maxi_code_codetext.second_message = standard_second_message
generator = ComplexBarcodeGenerator(maxi_code_codetext)
generator.generate_barcode_image()
# Mode 3 with structured second message
maxi_code_codetext = MaxiCodeCodetextMode3()
maxi_code_codetext.postal_code = "B1050"
maxi_code_codetext.country_code = 156
maxi_code_codetext.service_category = 999
structured_second_message = MaxiCodeStructuredSecondMessage()
structured_second_message.add("634 ALPHA DRIVE")
structured_second_message.add("PITTSBURGH")
structured_second_message.add("PA")
structured_second_message.year = 99
maxi_code_codetext.second_message = structured_second_message
generator = ComplexBarcodeGenerator(maxi_code_codetext)
generator.generate_barcode_image()
# Decoding raw codetext with standard second message
reader = BarCodeReader(image_path, DecodeType.MAXI_CODE)
for result in reader.read_barcodes():
maxi_code_codetext = ComplexCodetextReader.try_decode_maxi_code(
result.extended.maxi_code.mode, result.code_text
)
if isinstance(maxi_code_codetext, MaxiCodeCodetextMode3):
structured_codetext = maxi_code_codetext
print("Postal code:", structured_codetext.postal_code)
print("Country code:", structured_codetext.country_code)
print("Service category:", structured_codetext.service_category)
if isinstance(structured_codetext.second_message, MaxiCodeStandardSecondMessage):
second_message = structured_codetext.second_message
print("Message:", second_message.message)
# Decoding raw codetext with structured second message
reader = BarCodeReader(image_path, DecodeType.MAXI_CODE)
for result in reader.read_barcodes():
maxi_code_codetext = ComplexCodetextReader.try_decode_maxi_code(
result.extended.maxi_code.mode, result.code_text
)
if isinstance(maxi_code_codetext, MaxiCodeCodetextMode3):
structured_codetext = maxi_code_codetext
print("Postal code:", structured_codetext.postal_code)
print("Country code:", structured_codetext.country_code)
print("Service category:", structured_codetext.service_category)
if isinstance(structured_codetext.second_message, MaxiCodeStructuredSecondMessage):
second_message = structured_codetext.second_message
print("Message:")
for identifier in second_message.identifiers:
print(identifier)

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.