Browse our Products

Aspose.BarCode for PHP via Java 24.9

All Changes

KeySummaryCategory
BARCODENET-38022AustralianPostShortBarHeight is ignoredBug + Enhancement
BARCODENET-38369Update PZN encoder, decoderEnhancement
BARCODENET-39081Add tests for functionality that was added in release 24.6 including setters and gettersQuality issue
BARCODENET-39089Recognize and add QrVersion to QRExtendedParameters in BarCodeResultEnhancement

Public API changes and backwards compatibility

AustraliaPost, Planet, Postnet barcodes generation

AustraliaPost, Planet, Postnet barcodes generation is changed.

AustralianPost.AustralianPostShortBarHeight by default is set to zero and calculated by default as 0.26 from BarHeight.

    //AustraliaPost barcode generation
    public function  example1()
    {
        $generator = new BarcodeGenerator(EncodeTypes::AUSTRALIA_POST, "6212345678AP");
        $generator->getParameters()->getBarcode()->getAustralianPost()->setAustralianPostEncodingTable(CustomerInformationInterpretingType::C_TABLE);
        $generator->getParameters()->getBarcode()->getBarHeight()->setPixels(100);
        $generator->save(self::image_path_to_save1,BarCodeImageFormat::PNG);
    }
   // If short bar is not specified, it is scaled to 0.26 * BarHeight
    public function example2()
    {
        $gen = new BarcodeGenerator(EncodeTypes::AUSTRALIA_POST, "6212345678AP");
        $gen->getParameters()->getBarcode()->getAustralianPost()->getAustralianPostShortBarHeight()->setPixels(10);
        $gen->getParameters()->getBarcode()->getPadding()->getLeft()->setPixels(10);
        $gen->getParameters()->getBarcode()->getPadding()->getTop()->setPixels(10);
        $gen->getParameters()->getBarcode()->getPadding()->getRight()->setPixels(10);
        $gen->getParameters()->getBarcode()->getPadding()->getBottom()->setPixels(10);
        $gen->save(self::image_path_to_save2, BarCodeImageFormat::PNG);
    }

Postal.PostalShortBarHeight by default is set to zero and calculated by default as 0.5 from BarHeight.

    //Planet, Postnet barcodes generation
    public function example3()
    {
        $gen = new BarcodeGenerator(EncodeTypes::POSTNET, "5552357000");
        $gen->getParameters()->getBarcode()->getBarHeight()->setPixels(100);
        // If short bar is not specified, it is scaled to 0->5 * BarHeight
        $gen->getParameters()->getBarcode()->getPostal()->getPostalShortBarHeight()->setPixels(40);
        $gen->getParameters()->getBarcode()->getCodeTextParameters()->setLocation(CodeLocation::NONE);
        $gen->getParameters()->getBarcode()->getPadding()->getLeft()->setPixels(10);
        $gen->getParameters()->getBarcode()->getPadding()->getTop()->setPixels(10);
        $gen->getParameters()->getBarcode()->getPadding()->getRight()->setPixels(10);
        $gen->getParameters()->getBarcode()->getPadding()->getBottom()->setPixels(10);
        $gen->save(self::image_path_to_save3, BarCodeImageFormat::PNG);
    }

PZN7 and PZN8 barcodes generation

PZN8 and PZN7 encoding and decoding are supported:

  • To encode PZN7 it is needed to provide 6 digits or less to CodeText, like “123456”.
  • To encode PZN8 it is needed to provide 7 digits or more to CodeText, like “1234567”.
  • Provided last checksum digit is ignored and generated by the barcode engine.
    // Encode and decode PZN7
    // When you provide a 6-digit code text to the BarcodeGenerator with EncodeTypes.PZN, 
    // the library interprets it as a PZN7 barcode. 
    // The PZN7 format consists of 7 digits: 6 data digits plus 1 check digit calculated by the system.
    public function example4()
    {
         $gen = new BarcodeGenerator(EncodeTypes::PZN, "123456");
         $reader = new BarCodeReader($gen->generateBarCodeImage(BarCodeImageFormat::PNG), null, DecodeType::PZN);
        $barCodeResults = $reader->readBarCodes();
        foreach ($barCodeResults as $result) {
            echo $result->getCodeTypeName() . ': ' . $result->getCodeText() . PHP_EOL;
        }
    }

    //Encode and decode PZN8
    //When you provide a 7-digit code text, the library generates a PZN8 barcode. 
    // The PZN8 format consists of 8 digits: 7 data digits plus 1 check digit calculated by the system.
    public function example5()
    {
         $gen = new BarcodeGenerator(EncodeTypes::PZN, "1234567");
         $reader = new BarCodeReader($gen->generateBarCodeImage(BarCodeImageFormat::PNG), null,DecodeType::PZN);
        $barCodeResults = $reader->readBarCodes();
        foreach ($barCodeResults as $result) {
            echo $result->getCodeTypeName() . ': ' . $result->getCodeText() . PHP_EOL;
        }
    }

QR, MicroQR, RectMicroQR barcodes recognition

QR, MicroQR, RectMicroQR barcodes recognition parameters obtained new public properties QRVersion, MicroQRVersion, RectMicroQRVersion and QRErrorLevel, which have been added to the QRExtendedParameters.

    public function example6()
    {
         $gen = new BarcodeGenerator(EncodeTypes::QR, "Aspose");
            $gen->getParameters()->getBarcode()->getQR()->setQrVersion(QRVersion::VERSION_15);
            $gen->getParameters()->getBarcode()->getQR()->setQrErrorLevel(QRErrorLevel::LEVEL_M);
         $reader = new BarCodeReader($gen->generateBarCodeImage(BarCodeImageFormat::PNG), null, DecodeType::QR);
        $barCodeResults = $reader->readBarCodes();
        foreach ($barCodeResults as $result) {
            echo "Codetype: ".$result->getCodeTypeName(). PHP_EOL;
            echo "Codetext: ".$result->getCodeText(). PHP_EOL;
            echo "QR version: ".$result->getExtended()->getQR()->getQRVersion(). PHP_EOL;
            echo "Error level: ".$result->getExtended()->getQR()->getQRErrorLevel(). PHP_EOL;
        }
    }
}

Result:

Codetype: QR
Codetext: Aspose
QR version: VERSION_15
Error level: LEVEL_M