This technical tip shows how to Read Barcode from Multi-page TIFF Images using Aspose.BarCode for Java. Please make sure to install JRE 1.5 or above to run and JDK 1.5 or above for development. Then Download Aspose.BarCode for Java and install it as well. Below is the sample code for recognizing barcodes with in a multi-page tiff image.


import com.aspose.barcode.*;

import javax.imageio.ImageReader;
import java.awt.image.BufferedImage;
import java.util.Iterator;

* Read barcodes from multi-pages tiff image sample
* Integreted Sun's JAI (Java Advanced Imaging) Library to working with tiff files
* Details information about JAI: Java Media APIs
public class TiffWithJAI {

public static void main(String[] args) throws Exception {
String fileName = "C:\\multi_page.tiff";
Iterator readers = javax.imageio.ImageIO.getImageReadersBySuffix("tif f");
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) (;
if (_imageReader != null) {
_imageReader.setInput(iis, true);
//Feed each page to the BarCodeReader
for (int i = 0; i < pageCount; i++) {
BufferedImage _bufferedImage =;
com.BarCodeReader reader = new BarCodeReader(_bufferedImage, BarCodeReadType.Datamatrix);
//Read the barcodes in a single page
while (


More about Aspose.BarCode for Java

- Homepage of Aspose.BarCode for Java: Java Barcode Generator & Reader Library, Export Barcodes to Images

- Read more technical tips by Aspose.BarCode for Java: Aspose.BarCode for Java - Documentation

- Download Aspose.BarCode for Java: Aspose.BarCode for Java - Java Components - Files

Contact Information
Suite 119, 272 Victoria Avenue
Chatswood, NSW, 2067
File Format Components for .NET Java SSRS SharePoint JasperReports
Phone: 888.277.6734
Fax: 866.810.9465l