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.
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());
Console.WriteLine(ocrEngine.Pages[iCunt].PageText);
}
}
ikram.haq:
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)?