public boolean isBarcodePresent(String tiffFile) throws IOException{
boolean isBarcodePresent = false;
BufferedImage bufferedTifImage = ImageIO.read(new File(tiffFile));
LuminanceSource source = new BufferedImageLuminanceSource(bufferedTifImage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Reader reader = new MultiFormatReader();
Result result = null;
try {
Map<DecodeHintType,Object> tmpHintsMap = new EnumMap<DecodeHintType, Object>(DecodeHintType.class);
tmpHintsMap.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
result = reader.decode(bitmap, tmpHintsMap);
} catch (Exception e) {
log.error("Exception while reading barcode", e);
isBarcodePresent = false;
}
if (result != null && result.getText().equalsIgnoreCase("TRANSACTION")) {
isBarcodePresent = true;
}
return isBarcodePresent;
}