Hi Team,
I am working on POC for one of our client. Aspart of the POC our requirement is to read barcode from the all the pages of a Tif file. I have downloaded the trial version of Aspose Barcode api to read barcodes from Tiff file. When i run the code I could see that barcode is not readable for few of Tif files (attached sampe, one is readable and non-readble).
Below is the code snippet i am using to read the barcode. Please check and let me know if I am missing any details.
\";
public static void main (String args[]) {
try {
int scount = 0;
int fcount = 0;
File file = new File(folderPath);
File []filearray = file.listFiles();
for (int i = 0; i < filearray.length; i ++) {
File tifFile = filearray[i];
System.out.println("File "+tifFile.getAbsolutePath());
if(decodeBarCode(new File(tifFile.getAbsolutePath())))
scount++;
else
fcount++;
}
System.out.println("Success Count " + scount);
System.out.println("Failed Count " + fcount);
} catch (Exception e) {
e.printStackTrace();
}
}
private static boolean decodeBarCode(File file) throws Exception {
BarCodeReader reader = new BarCodeReader(file.getAbsolutePath(), DecodeType.CODE_128);
reader.setQualitySettings(QualitySettings.getHighPerformance());
BarCodeResult []result = reader.readBarCodes();
for (int j = 0; j < result.length; j++) {
System.out.println("CodeText: " + result[j].getCodeText());
//System.out.println("Symbology type: " + result[j].getCodeType());
// Get checksum value
//System.out.println("Checksum:" + result[j].getExtended().getOneD().getCheckSum());
}
if(result.length == 0)
return false;
else
return true;
}
}barcodeissues.zip (7.1 KB)