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

Free Support Forum - aspose.com

Convert Scanned PDF to Searchable PDF C# using Aspose.PDF for .NET

Hi,

I am not able to convert scanned pdf file having only one page to searchable pdf.I am using evaluation version to do this.I wanted to test if aspose can do this to go for license.

Error I am getting System.IndexOutOfRangeException: 'At most 4 elements (for any collection) can be viewed in evaluation mode.'

I am using this code

Document doc = new Document(@“C:\Test.pdf”);

        doc.Convert(CallBackGetHocr);
        doc.Save(@"C:\Editable.pdf");

static string CallBackGetHocr(System.Drawing.Image img)
{

        string dir = @"C:\Temp\";
        img.Save(dir + "ocrtest.jpg");
        ProcessStartInfo info = new ProcessStartInfo(@"C:\Program Files (x86)\Blue Prism Limited\Blue Prism Automate\Tesseract\tesseract.exe");
        info.WindowStyle = ProcessWindowStyle.Hidden;
        info.Arguments = @"C:\Temp\ocrtest.jpg C:\Temp\out hocr";
        Process p = new Process();
        p.StartInfo = info;
        p.Start();
        p.WaitForExit();
        StreamReader streamReader = new StreamReader(@"C:\Temp\out.hocr");
        string text = streamReader.ReadToEnd();
        streamReader.Close();
        return text;
    }

@Gowtham.Alluri,

Can you please share source files so that we may further investigate to help you out.

@Gowtham.Alluri

Adding more to comments by Adnan, the exception is occurring due to evaluation version of the API. Please try using API with valid license and in case you do not have one, please consider applying for 30-days free temporary license which will help you evaluating the API without any limitation.