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

Free Support Forum - aspose.com

Convert Scanned PDF to Excel - URGENT

Hi Team,

I have a scanned pdf. I am trying to convert it to excel. I am not sure how to use Aspose.OCR. I am pretty new to it. i tried to find documentation but there was nothing clear,

I tired the following code. Is it the right code to do this ?
if this is right in the following code the ocr engine is not getting recognized.

static void Main(string[] args)
Aspose.OCR.License license = new Aspose.OCR.License();

        //Create an instance of Document to load the PDF
        Document pdfDocument = new Document(@"C:\PDFs\ScannedForAspose.pdf");

        //Create an instance of OcrEngine for recognition
        Aspose.OCR.OcrEngine ocrEngine = new Aspose.OCR.OcrEngine();

        //Iterate over the pages of PDF
        for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)
            //Creating a MemoryStream to hold the image temporarily
            using (MemoryStream imageStream = new MemoryStream())
                //Create Resolution object
                Resolution resolution = new Resolution(300);

                JpegDevice jpegDevice = new JpegDevice();

                //Convert a particular page and save the image to stream
                jpegDevice.Process(pdfDocument.Pages[pageCount], imageStream);
                imageStream.Position = 0;
                ocrEngine.Image = ImageStream.FromStream(imageStream, ImageStreamFormat.Jpg);

                //Perform OCR operation on one page at a time
                if (ocrEngine.Process())


Please use Aspose.OCR for .NET 20.7 version along with following code snippet:

AsposeOcr api = new AsposeOcr();
// Recognize image
string result = api.RecognizeImage(imageStream);
// Display the recognized text

imageStream in the above code will be the same in which image is being stored by Aspose.PDF for .NET.


When i made the above change i get the following error:

Message=Could not find file ‘C:\Users\abcd\source\repos\ConsoleApp4\ConsoleApp4\bin\Debug\netcoreapp3.1\System.IO.MemoryStream’.

Not sure what are we looking in for here.

Also, i had another question can i convert the scanned pdf to text file ?


Would you kindly share a sample console application which is able to reproduce the issue that you are facing. We will test it in our environment and address the issue accordingly.

Does your scanned PDF contain a layer of hidden text already? If it does not, sadly it cannot be directly converted to text file.