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.MwMaxiCodeCodetextMode3"
 

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 3. This sample shows how to encode and decode MaxiCode codetext for mode 3.

//Mode 3 with standart second message
$maxiCodeCodetext = new MaxiCodeCodetextMode3();
$maxiCodeCodetext->setPostalCode("B1050");
$maxiCodeCodetext->setCountryCode(056);
$maxiCodeCodetext->setServiceCategory(999);
MaxiCodeStandartSecondMessage maxiCodeStandartSecondMessage = new MaxiCodeStandartSecondMessage();
maxiCodeStandartSecondMessage->setMessage("Test message");
$maxiCodeCodetext->setSecondMessage(maxiCodeStandartSecondMessage);
ComplexBarcodeGenerator complexGenerator = new ComplexBarcodeGenerator($maxiCodeCodetext);
complexGenerator.generateBarCodeImage(BarcodeImageFormat::PNG);
//Mode 3 with structured second message
MaxiCodeCodetextMode3 $maxiCodeCodetext = new MaxiCodeCodetextMode3();
$maxiCodeCodetext->setPostalCode("B1050");
$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 MaxiCodeCodetextMode3)
{
MaxiCodeCodetextMode3 maxiCodeStructuredCodetext = (MaxiCodeCodetextMode3)$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 MaxiCodeCodetextMode3)
{
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:");
foreach($secondMessage->getIdentifiers() as $identifier)
{
print($identifier);
}
}
}
}

Constructor & Destructor Documentation

◆ __construct()

MaxiCodeCodetextMode3::__construct ( )

Member Function Documentation

◆ construct()

static MaxiCodeCodetextMode3::construct (   $javaClass)
static

◆ getMode()

MaxiCodeCodetextMode3::getMode ( )

Gets MaxiCode mode.

Returns
int MaxiCode mode

Reimplemented from MaxiCodeCodetext.

◆ init()

MaxiCodeCodetextMode3::init ( )
protected

Reimplemented from MaxiCodeStructuredCodetext.

Member Data Documentation

◆ JAVA_CLASS_NAME

const MaxiCodeCodetextMode3::JAVA_CLASS_NAME = "com.aspose.mw.barcode.complexbarcode.MwMaxiCodeCodetextMode3"