We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Sample code to OCR multipage TIF file

I’m trying to evaluate the Aspose OCR toolkit and looking for some sample code to OCR a multipage TIF file. I have the sample code for a single image and some code that kinda shows how to read multiple pages with the Imaging toolkit, but supposedly multipage support was added to the OCR toolkit. So just trying to figure out how to accomplish this without have to break out each individual page somehow.

Hi Brent,

Thank you for considering Aspose APIs.

Please, note that you can perform OCR operation on a multi-page or multi-frame TIFF image using Aspose.OCR. What you need to do is simply create an instance of OcrEngine class. Load the image and assign it to Image property of the OcrEngine class instance. Set the ProcessAllPages property to TRUE. Process the image. Access the Pages property of the OcrEngine class. Note that Pages property is only available when recognition is complete. Otherwise it will through exception.

Sample code to perform OCR operation on a multi-page TIFF image along with the sample TIFF image used in the code has been attached for your kind reference. We have used the latest version Aspose.OCR for .NET 2.9.0.

//Initialize an instance of OcrEngine
OcrEngine ocrEngine = new OcrEngine();

//Set the Image property by loading the image from file path location or an instance of MemoryStream
ocrEngine.Image = ImageStream.FromFile(@"C:\multipage_tiff_example.tiff");
ocrEngine.ProcessAllPages = true;
//Process the image
if (ocrEngine.Process())
//Display the recognized text
Console.WriteLine("Total pages in the TIFF file: " + ocrEngine.Pages.Count().ToString());
for (int iCunt = 0; iCunt <= (ocrEngine.Pages.Count()-1); iCunt++)
Console.WriteLine("Page/Frame # : " + (iCunt+1).ToString());

Hope the above information helps. In case of any issues, need further clearance please be sure to let us know, we will be glad to assist you.


I have a PDF which is not created by printing, but created by scanning. When I try to convert that to excel I do not get any contents - Is that not possible and do I have the OCR sample you have listed (Id: 654640)?

Hi Brent,

Please forward us the sample PDF file(s) so that we may look into it at our end and provide you update accordingly.