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

Macro Characters 05 and 06 values are used to obtain more compact encoding in special modes. More...

Inherits Enum.

Static Public Attributes

int MACRO_05 = 5
 05 Macro craracter is added to barcode data in first position. More...
 
int MACRO_06 = 6
 06 Macro craracter is added to barcode data in first position. More...
 
int NONE = 0
 None of Macro Characters are added to barcode data. More...
 

Detailed Description

Macro Characters 05 and 06 values are used to obtain more compact encoding in special modes.

05 Macro craracter is translated to "[)>\u001E05\u001D" as decoded data header and "\u001E\u0004" as decoded data trailer. 06 Macro craracter is translated to "[)>\u001E06\u001D" as decoded data header and "\u001E\u0004" as decoded data trailer. here samples show how to encode Macro Characters in MicroPdf417 and DataMatrix

# to generate autoidentified GS1 message like this "(10)123ABC(10)123ABC" in ISO 15434 format you need:
generator = Generation.BarcodeGenerator(Generation.EncodeTypes.DATA_MATRIX, "10123ABC\u001D10123ABC")
generator.getParameters().getBarcode().getDataMatrix().setMacroCharacters(Generation.MacroCharacter.MACRO_05)
reader = Recognition.BarCodeReader(generator.generateBarCodeImage(), None, Recognition.DecodeType.GS_1_DATA_MATRIX)
for result in reader.readBarCodes():
print("\nBarCode CodeText: " + result.getCodeText())
# Encodes MicroPdf417 with 05 Macro the string: "[)>\u001E05\u001Dabcde1234\u001E\u0004"
generator = Generation.BarcodeGenerator(Generation.EncodeTypes.MICRO_PDF_417, "abcde1234")
generator.getParameters().getBarcode().getPdf417().setMacroCharacters(Generation.MacroCharacter.MACRO_05)
reader = Recognition.BarCodeReader(generator.generateBarCodeImage(), None, Recognition.DecodeType.MICRO_PDF_417)
for result in reader.readBarCodes():
print("BarCode CodeText: " + result.getCodeText())
# Encodes MicroPdf417 with 06 Macro the string: "[)>\u001E06\u001Dabcde1234\u001E\u0004"
generator = Generation.BarcodeGenerator(Generation.EncodeTypes.MICRO_PDF_417, "abcde1234")
generator.getParameters().getBarcode().getPdf417().setMacroCharacters(Generation.MacroCharacter.MACRO_06)
reader = Recognition.BarCodeReader(generator.generateBarCodeImage(), None, Recognition.DecodeType.MICRO_PDF_417)
for result in reader.readBarCodes():
print("BarCode CodeText: " + result.getCodeText())

Member Data Documentation

◆ MACRO_05

int MACRO_05 = 5
static

05 Macro craracter is added to barcode data in first position.

GS1 Data Identifier ISO 15434 Character is translated to "[)>\u001E05\u001D" as decoded data header and "\u001E\u0004" as decoded data trailer. to generate autoidentified GS1 message like this "(10)123ABC(10)123ABC" in ISO 15434 format you need:

generator = Generation.BarcodeGenerator(Generation.EncodeTypes.DATA_MATRIX, "10123ABC\u001D10123ABC")
#to generate autoidentified GS1 message like this "(10)123ABC(10)123ABC" in ISO 15434 format you need:
generator.getParameters().getBarcode().getDataMatrix().setMacroCharacters(Generation.MacroCharacter.MACRO_05)
#to generate autoidentified GS1 message like this "(10)123ABC(10)123ABC" in ISO 15434 format you need:
reader = Recognition.BarCodeReader(generator.generateBarCodeImage(), None,Recognition.DecodeType.GS_1_DATA_MATRIX)
#to generate autoidentified GS1 message like this "(10)123ABC(10)123ABC" in ISO 15434 format you need:
results = reader.readBarCodes()
for result in results:
print(f"\nBarCode Type: {result.getCodeTypeName()}")
print(f"BarCode CodeText: {result.getCodeText()}")

◆ MACRO_06

int MACRO_06 = 6
static

06 Macro craracter is added to barcode data in first position.

ASC MH10 Data Identifier ISO 15434 Character is translated to "[)>\u001E06\u001D" as decoded data header and "\u001E\u0004" as decoded data trailer.

◆ NONE

int NONE = 0
static

None of Macro Characters are added to barcode data.