com.aspose.barcode.barcoderecognition

Class BarcodeSettings

  • java.lang.Object
    • com.aspose.barcode.barcoderecognition.BarcodeSettings


  • public class BarcodeSettings
    extends java.lang.Object
    The main BarCode decoding parameters. Contains parameters which make influence on recognized data.
    • Constructor Detail

      • BarcodeSettings

        public BarcodeSettings()
        BarcodeSettings constructor
      • BarcodeSettings

        public BarcodeSettings(BarcodeSettings settings)
        BarcodeSettings copy constructor
        Parameters:
        settings - The source of the data
    • Method Detail

      • getChecksumValidation

        public ChecksumValidation getChecksumValidation()
        Enable checksum validation during recognition for 1D and Postal barcodes. Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible. Checksum never used: Codabar, PatchCode, Pharmacode, DataLogic2of5 Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, ItalianPost25, Matrix2of5, MSI, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN Checksum always used: Rest symbologies Example BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.EAN_13, "1234567890128"); generator.save("c:/test.png"); BarCodeReader reader = new BarCodeReader("c:/test.png", DecodeType.EAN_13); //checksum disabled reader.getBarcodeSettings().setChecksumValidation(ChecksumValidation.OFF); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode CodeText: " + result.getCodeText()); System.out.println("BarCode Value: " + result.getExtended().getOneD().getValue()); System.out.println("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum()); } BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.EAN_13); //checksum enabled reader.getBarcodeSettings().setChecksumValidation(ChecksumValidation.ON); for (BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode CodeText: " + result.CodeText); System.out.println("BarCode Value: " + result.getExtended().getOneD().getValue()); System.out.println("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum()); }
        Returns:
        Enable checksum validation during recognition for 1D and Postal barcodes.
      • setChecksumValidation

        public void setChecksumValidation(ChecksumValidation value)
        Enable checksum validation during recognition for 1D and Postal barcodes. Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible. Checksum never used: Codabar, PatchCode, Pharmacode, DataLogic2of5 Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, ItalianPost25, Matrix2of5, MSI, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN Checksum always used: Rest symbologies Example BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.EAN_13, "1234567890128"); generator.save("c:/test.png"); BarCodeReader reader = new BarCodeReader("c:/test.png", DecodeType.EAN_13); //checksum disabled reader.getBarcodeSettings().setChecksumValidation(ChecksumValidation.OFF); for(BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode CodeText: " + result.getCodeText()); System.out.println("BarCode Value: " + result.getExtended().getOneD().getValue()); System.out.println("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum()); } BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.EAN_13); //checksum enabled reader.getBarcodeSettings().setChecksumValidation(ChecksumValidation.ON); for (BarCodeResult result : reader.readBarCodes()) { System.out.println("BarCode CodeText: " + result.CodeText); System.out.println("BarCode Value: " + result.getExtended().getOneD().getValue()); System.out.println("BarCode Checksum: " + result.getExtended().getOneD().getCheckSum()); }
        Parameters:
        value - Enable checksum validation during recognition for 1D and Postal barcodes.
      • getStripFNC

        public boolean getStripFNC()
        Strip FNC1, FNC2, FNC3 characters from codetext. Default value is false. Example BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.GS_1_CODE_128, "(02)04006664241007(37)1(400)7019590754"); generator.save("c:/test.png"); BarCodeReader reader = new BarCodeReader("c:/test.png", DecodeType.CODE_128); //StripFNC disabled reader.getBarcodeSettings().setStripFNC(false); for(BarCodeResult result : reader.readBarCodes()) { System.our.println("BarCode CodeText: " + result.getCodeText()); } BarCodeReader reader = new BarCodeReader("c:/test.png", DecodeType.CODE_128); //StripFNC enabled reader.getBarcodeSettings().setStripFNC(true); for(BarCodeResult result : reader.readBarCodes()) { System.our.println("BarCode CodeText: " + result.getCodeText()); }
        Returns:
        Strip FNC1, FNC2, FNC3 characters from codetext. Default value is false.
      • setStripFNC

        public void setStripFNC(boolean value)
        Strip FNC1, FNC2, FNC3 characters from codetext. Default value is false. Example BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.GS_1_CODE_128, "(02)04006664241007(37)1(400)7019590754"); generator.save("c:/test.png"); BarCodeReader reader = new BarCodeReader("c:/test.png", DecodeType.CODE_128); //StripFNC disabled reader.getBarcodeSettings().setStripFNC(false); for(BarCodeResult result : reader.readBarCodes()) { System.our.println("BarCode CodeText: " + result.getCodeText()); } BarCodeReader reader = new BarCodeReader("c:/test.png", DecodeType.CODE_128); //StripFNC enabled reader.getBarcodeSettings().setStripFNC(true); for(BarCodeResult result : reader.readBarCodes()) { System.our.println("BarCode CodeText: " + result.getCodeText()); }
        Parameters:
        value - Strip FNC1, FNC2, FNC3 characters from codetext. Default value is false.
      • getDetectEncoding

        public boolean getDetectEncoding()
        The flag which force engine to detect codetext encoding for Unicode codesets. Default value is true. Example BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR, "Слово")) generator.getParameters().getBarcode().getQR().setCodeTextEncoding(Charset.forName("UTF-8")); BufferedImage im = generator.generateBarcodeImage(); //detects encoding for Unicode codesets is enabled BarCodeReader reader = new BarCodeReader(im, DecodeType.QR); reader.getBarcodeSettings().setDetectEncoding(true); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText()); //detect encoding is disabled BarCodeReader reader = new BarCodeReader(im, DecodeType.QR); reader.getBarcodeSettings().setDetectEncoding(false); for(BarCodeResult result : reader.readBarCodes()) System.out.println("BarCode CodeText: " + result.getCodeText());
        Returns:
        The flag which force engine to detect codetext encoding for Unicode codesets
      • setDetectEncoding

        public void setDetectEncoding(boolean value)
      • getAustraliaPost

        public AustraliaPostSettings getAustraliaPost()
        Gets AustraliaPost decoding parameters
        Returns:
        The AustraliaPost decoding parameters which make influence on recognized data of AustraliaPost symbology