Aspose.Barcode for PHP via Java Generation and Recognition API docs

Inherits MaxiCodeStructuredCodetext.

Public Member Functions

 __construct ()
 
 getMode ()
 
- Public Member Functions inherited from MaxiCodeStructuredCodetext
 __construct ($javaClass)
 
 getPostalCode ()
 
 setPostalCode (string $value)
 
 getCountryCode ()
 
 setCountryCode (int $value)
 
 getServiceCategory ()
 
 setServiceCategory (int $value)
 
 getSecondMessage ()
 
 setSecondMessage (MaxiCodeSecondMessage $value)
 
 getConstructedCodetext ()
 
 initFromString (string $constructedCodetext)
 
 equals ($obj)
 
 getHashCode ()
 
- Public Member Functions inherited from MaxiCodeCodetext
 getMaxiCodeEncodeMode ()
 
 setMaxiCodeEncodeMode (int $value)
 
 getECIEncoding ()
 
 setECIEncoding (int $value)
 
 getBarcodeType ()
 
- Public Member Functions inherited from BaseJavaClass
 getJavaClass ()
 
 getJavaClassName ()
 
 isNull ()
 
 printJavaClassName ()
 

Static Public Member Functions

static construct ($javaClass)
 

Public Attributes

const JAVA_CLASS_NAME = "com.aspose.mw.barcode.complexbarcode.MwMaxiCodeCodetextMode2"
 

Protected Member Functions

 init ()
 
- Protected Member Functions inherited from BaseJavaClass
 setJavaClass ($javaClass)
 

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.

//Mode 2 with standart second message
$maxiCodeCodetext = new MaxiCodeCodetextMode2();
$maxiCodeCodetext->setPostalCode("524032140");
$maxiCodeCodetext->setCountryCode(056);
$maxiCodeCodetext->setServiceCategory(999);
$maxiCodeStandartSecondMessage = new MaxiCodeStandartSecondMessage();
$maxiCodeStandartSecondMessage->setMessage("Test message");
$maxiCodeCodetext->setSecondMessage($maxiCodeStandartSecondMessage);
$complexGenerator = new ComplexBarcodeGenerator($maxiCodeCodetext);
$complexGenerator->generateBarCodeImage(BarcodeImageFormat::PNG);
//Mode 2 with structured second message
$maxiCodeCodetext = new MaxiCodeCodetextMode2();
$maxiCodeCodetext->setPostalCode("524032140");
$maxiCodeCodetext->setCountryCode(056);
$maxiCodeCodetext->setServiceCategory(999);
$maxiCodeStructuredSecondMessage = new MaxiCodeStructuredSecondMessage();
$maxiCodeStructuredSecondMessage->add("634 ALPHA DRIVE");
$maxiCodeStructuredSecondMessage->add("PITTSBURGH");
$maxiCodeStructuredSecondMessage->add("PA");
$maxiCodeStructuredSecondMessage->setYear(99);
$maxiCodeCodetext->setSecondMessage(maxiCodeStructuredSecondMessage);
$complexGenerator = new ComplexBarcodeGenerator($maxiCodeCodetext);
$complexGenerator->generateBarCodeImage(BarcodeImageFormat::PNG);
//Decoding raw codetext with standart second message
$reader = new BarCodeReader("c:\\test.png", DecodeType::MAXI_CODE);
{
foreach($reader->readBarCodes() as $result)
{
$resultMaxiCodeCodetext = ComplexCodetextReader::tryDecodeMaxiCode($result->getExtended()->getMaxiCode()->getMaxiCodeMode(), $result->getCodeText());
if ($resultMaxiCodeCodetext instanceof MaxiCodeCodetextMode2)
{
$maxiCodeStructuredCodetext = $resultMaxiCodeCodetext;
print("BarCode Type: ".$maxiCodeStructuredCodetext->getPostalCode());
print("MaxiCode mode: ".$maxiCodeStructuredCodetext->getCountryCode());
print("BarCode CodeText: ".$maxiCodeStructuredCodetext->getServiceCategory());
if ($maxiCodeStructuredCodetext->getSecondMessage() instanceof MaxiCodeStandartSecondMessage){
$secondMessage = $maxiCodeStructuredCodetext->getSecondMessage();
print("Message: ".$secondMessage->getMessage());
}
}
}
}
//Decoding raw codetext with structured second message
$reader = new BarCodeReader("c:\\test.png", DecodeType::MAXI_CODE);
{
foreach($reader->readBarCodes() as $result)
{
$resultMaxiCodeCodetext = ComplexCodetextReader::tryDecodeMaxiCode($result->getExtended()->getMaxiCode()->getMaxiCodeMode(), $result->getCodeText());
if ($resultMaxiCodeCodetext instanceof MaxiCodeCodetextMode2){
$maxiCodeStructuredCodetext = $resultMaxiCodeCodetext;
print("BarCode Type: ".$maxiCodeStructuredCodetext->getPostalCode());
print("MaxiCode mode: ".$maxiCodeStructuredCodetext->getCountryCode());
print("BarCode CodeText: ".$maxiCodeStructuredCodetext->getServiceCategory());
if ($maxiCodeStructuredCodetext->getSecondMessage() instanceof MaxiCodeStructuredSecondMessage)
{
$secondMessage = $maxiCodeStructuredCodetext->getSecondMessage();
print("Message:");
for ($secondMessage->getIdentifiers() as $identifier){
print($identifier);
}
}
}
}
}

Constructor & Destructor Documentation

◆ __construct()

MaxiCodeCodetextMode2::__construct ( )

Member Function Documentation

◆ construct()

static MaxiCodeCodetextMode2::construct (   $javaClass)
static

◆ getMode()

MaxiCodeCodetextMode2::getMode ( )

Gets MaxiCode mode.

Returns
int MaxiCode mode

Reimplemented from MaxiCodeCodetext.

◆ init()

MaxiCodeCodetextMode2::init ( )
protected

Reimplemented from MaxiCodeStructuredCodetext.

Member Data Documentation

◆ JAVA_CLASS_NAME

const MaxiCodeCodetextMode2::JAVA_CLASS_NAME = "com.aspose.mw.barcode.complexbarcode.MwMaxiCodeCodetextMode2"