Hi,
We have below code for extracting barcode from TIFF(see attchment). Still not able to read. Please advise. Thanks.
System.out.println(System.getProperty("java.class.path"));<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Iterator readers = javax.imageio.ImageIO.getImageReadersBySuffix("tiff");
String fileName="c:/w8imytaxform-vertical.tif";
if (readers.hasNext()) {
File fi = new File(fileName);
ImageInputStream iis = javax.imageio.ImageIO.createImageInputStream(fi);
TIFFDecodeParam param = null;
ImageDecoder dec = ImageCodec.createImageDecoder("tiff", fi, param);
//Get the page count of the tiff image
int pageCount = dec.getNumPages();
ImageReader _imageReader = (ImageReader) (readers.next());
//System.out.println(_imageReader);
if (_imageReader != null) {
_imageReader.setInput(iis, true);
//Feed each page to the BarCodeReader
System.out.println(_imageReader);
for (int i = 0; i < pageCount; i++) {
BufferedImage _bufferedImage = _imageReader.read(i);
BarCodeReader reader = new BarCodeReader(_bufferedImage, BarCodeReadType.Code39Standard);
//Read the barcodes in a single page
while (reader.read()) {
System.out.println(reader.getCodeText());
}
}
}
}
My classpath has the below jars. Still not able to read.
C:\Working\workspace2\WorkSheet\lib\barcode\jai_codec.jar;
C:\Working\workspace2\WorkSheet\lib\barcode\jai_core.jar;
C:\Working\workspace2\WorkSheet\lib\barcode\mlibwrapper_jai.jar;
C:\Working\workspace2\WorkSheet\lib\barcode\jai_imageio.jar