Free Support Forum - aspose.com

Unable to read the barcodes from multipage TIF file

Hi,

In our application , we are converting a pdf to multipage TIF image using ASPOSE PDF JAVA API package and using the ASPOSE BARCODE JAVA API to read the barcode from the multipage TIF file.
The barcode is not readable for some of the pdfs while they are working fine for others. PFA the Pdf file that we are working with.

The code for BarCode Reading:

InputStream tiffStream = new FileInputStream(fileName);
BarCodeReader reader = new BarCodeReader(tiffStream);
BarCodeResult[] results = reader.readBarCodes();
for (BarCodeResult result : results) {
System.out.println("BarCode Type: " + result.getCodeTypeName());
System.out.println("BarCode CodeText: " + result.getCodeText());
}

.TSP-21-G.pdf (198.4 KB)
TSP-21-G.pdf (198.4 KB)

@klingareddy,
Please share your sample TIF file for our testing. We will reproduce the problem and provide our feedback after analysis. You can ZIP the files prior attaching.

Aspose barcode reads only first page from multipage tiff file. To read other pages you should manually split multipage tiff to single page images. I can provide code for this if you want.

I see possible problem with Code39 in pdf. Short black bars are too thin and can be wiped with low quality image scan. Because Code39 doesn’t have not checksum nor restoration information which may lead to the situation when this barcode could be unrecognizable. You can try pdf417 it is more durable and rectangular as Code39.

Thanks for the quick respose. Please share the code to split the multipage tiff to single page images. I will verify if the individual images are readable by barcodescanning.

And also this is the requirement for my application. Read a multipage pdf, validate for barcodes by reading all pages, and then convert it to multipage tif and send it to back end systems. Since you are saying inorder to read the barcode from each page i need to convert to individual images. So can you guide me the effecient way to do this since i am already converting pdf to multipage tif(which is required by backend). I am just looking for the sequence of steps that i can take inoder to acheive this with out spending a lot of time in conversions. Thanks.

@klingareddy,
We are working on this query and will share our feedback soon.

ImageSplitter.zip (1.2 KB)

I slightly cleared the code and here is you have pdf(with Aspose.PDF) and tiff splitter (ImageSplitter.cs) to the pages.

As example of usage:
List lPdfPages = ImageSplitter.SplitPDFToPages(@“d:\save\rec\TSP-21-G.pdf”);
List lTiffPages = ImageSplitter.SplitTiFFToPages(@“d:\save\rec\20130528092912147.tif”);

Now you can proceed ImagePage.Image with BarCodeReader.

I would need the Code for java implementation not the c#. Please share the java version of the above code. thanks.

@klingareddy,
We have noted your requirement and will get back to you soon to share our feedback.

For Java you can use code example from this place:
https://docs.aspose.com/display/barcodejava/How+to+Read+Barcode+from+Multi-page+TIFF+Images