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

Free Support Forum - aspose.com

Exception thrown in Aspose.PDF.dll GetNextImage

Seeing the following error

> Exception thrown: '#=zhqZCDh_kiUMv1MLnUfX5kULpbpeAAofF4as_A0yydKnjlK99Sg==' in Aspose.PDF.dll
> Exception thrown: '#=zhqZCDh_kiUMv1MLnUfX5kULpbpeAAofF4as_A0yydKnjlK99Sg==' in Aspose.PDF.dll

trying to use Aspose.OCR to extract text from images in a PDF with the following code. Which I have reduced to just getting the images to rule out other problems. Haven’t found any pattern as to why it is failing. I tried writing to a file and still get the error, the errored image is a black box.

The PDF appears to be a scanned document that was saved as a PDF, in that each page is an image. The document opens successfuly in acrobat reader.

    using (var pdfExtractor = new PdfExtractor())
    {
        pdfExtractor.BindPdf(fileSource);

        pdfExtractor.ExtractImage();
        while (pdfExtractor.HasNextImage())
        {
            using (var extractionStream = new MemoryStream())
            {
                pdfExtractor.GetNextImage(extractionStream);
            }
        }
    }

Using Aspose pdf 22.3.0, OCR 22.2

@johnwnowlin

Could you please share your sample PDF document for our reference so that we can test the scenario in our environment and address it accordingly?

Yes, link to sample.

@johnwnowlin

We used the same code snippet to test the scenario using Aspose.PDF for .NET 22.3 and we were unable to notice any issue. Can you please make sure that you are using the API with a valid or 30-days free temporary license? In case the issue still persists, please share a sample console application in .zip format with us which can reproduce the same issue. We will further proceed to assist you accordingly.

It appears to break when I nuget add Aspose.OCR . Here is a link to my console app that worked until I added OCR even though I did not actually use OCR.

https://www.dropbox.com/s/f2rc69mjmckjhbg/ConsoleAppPdfImages.zip?dl=0

ps. i removed the contents of the license file before zipping.

@johnwnowlin

We again tested using your console application and did not notice any issues. Can you please share on which page exactly the Exception is thrown?