Browse our Products

Aspose.BarCode for Android 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 void example1()
{
    BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.AUSTRALIA_POST, "6212345678AP");
    gen.getParameters().getBarcode().getAustralianPost().setAustralianPostEncodingTable(CustomerInformationInterpretingType.C_TABLE);
    gen.getParameters().getBarcode().getBarHeight().setPixels(100);
    gen.save(image_path_to_save);
}

// If short bar is not specified, it is scaled to 0.26 * BarHeight
public void example2()
{
    BarcodeGenerator 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(image_path_to_save2, com.aspose.barcode.generation.BarCodeImageFormat.PNG);
}

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

//Planet, Postnet barcodes generation
public void example3()
{
    BarcodeGenerator 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(image_path_to_save3, com.aspose.barcode.generation.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 void example4()
{
    BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.PZN, "123456");
    BarCodeReader reader = new BarCodeReader(gen.generateBarCodeImage(), DecodeType.PZN);
    BarCodeResult[] barCodeResults = reader.readBarCodes();
    for (BarCodeResult result : barCodeResults)
    {
        System.out.println(result.getCodeTypeName() + ":" + result.getCodeText());
    }
}

//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 void example5()
{
    BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.PZN, "1234567");
    BarCodeReader reader = new BarCodeReader(gen.generateBarCodeImage(), DecodeType.PZN);
    BarCodeResult[] barCodeResults = reader.readBarCodes();
    for (BarCodeResult result : barCodeResults)
    {
        System.out.println(result.getCodeTypeName() + ":" + result.getCodeText());
    }
}

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 void example6() throws IOException
{
    BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.QR, "Aspose");
    gen.getParameters().getBarcode().getQR().setQrVersion(QRVersion.VERSION_15);
    gen.getParameters().getBarcode().getQR().setQrErrorLevel(QRErrorLevel.LEVEL_M);
    BarCodeReader reader = new BarCodeReader(gen.generateBarCodeImage(), DecodeType.QR);
    BarCodeResult[] barCodeResults = reader.readBarCodes();
    for (BarCodeResult result : barCodeResults)
    {
        System.out.println("Codetype: " + result.getCodeTypeName());
        System.out.println("Codetext: " + result.getCodeText());
        System.out.println("QR version: " + result.getExtended().getQR().getQRVersion());
        System.out.println("Error level: " + result.getExtended().getQR().getQRErrorLevel());
    }
}

Result:

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