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.
$maxiCodeCodetext->setPostalCode("524032140");
$maxiCodeCodetext->setCountryCode(056);
$maxiCodeCodetext->setServiceCategory(999);
$maxiCodeStandartSecondMessage->setMessage("Test message");
$maxiCodeCodetext->setSecondMessage($maxiCodeStandartSecondMessage);
$complexGenerator->generateBarCodeImage(BarcodeImageFormat::PNG);
$maxiCodeCodetext->setPostalCode("524032140");
$maxiCodeCodetext->setCountryCode(056);
$maxiCodeCodetext->setServiceCategory(999);
$maxiCodeStructuredSecondMessage->add("634 ALPHA DRIVE");
$maxiCodeStructuredSecondMessage->add("PITTSBURGH");
$maxiCodeStructuredSecondMessage->add("PA");
$maxiCodeStructuredSecondMessage->setYear(99);
$maxiCodeCodetext->setSecondMessage(maxiCodeStructuredSecondMessage);
$complexGenerator->generateBarCodeImage(BarcodeImageFormat::PNG);
{
foreach($reader->readBarCodes() as $result)
{
{
$maxiCodeStructuredCodetext = $resultMaxiCodeCodetext;
print("BarCode Type: ".$maxiCodeStructuredCodetext->getPostalCode());
print("MaxiCode mode: ".$maxiCodeStructuredCodetext->getCountryCode());
print("BarCode CodeText: ".$maxiCodeStructuredCodetext->getServiceCategory());
$secondMessage = $maxiCodeStructuredCodetext->getSecondMessage();
print("Message: ".$secondMessage->getMessage());
}
}
}
}
{
foreach($reader->readBarCodes() as $result)
{
$maxiCodeStructuredCodetext = $resultMaxiCodeCodetext;
print("BarCode Type: ".$maxiCodeStructuredCodetext->getPostalCode());
print("MaxiCode mode: ".$maxiCodeStructuredCodetext->getCountryCode());
print("BarCode CodeText: ".$maxiCodeStructuredCodetext->getServiceCategory());
{
$secondMessage = $maxiCodeStructuredCodetext->getSecondMessage();
print("Message:");
for ($secondMessage->getIdentifiers() as $identifier){
print($identifier);
}
}
}
}
}