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

Free Support Forum - aspose.com

Identifying and Creating searchable PDF from Normal Scanned PDF

Hello,

I am evaluating your product Aspose.PDF in .Net platform for one of our client. We have to identify which PDFs are Normal scanned PDF and which are already have a text layer. The PDFs which do not have any text layer we want to create searchable PDF from them. The feature is similar to one which can be found in Adobe Acrobat, please refer attached screenshot.


Please send us the possible solution with Aspose.PDF as early as possible.
Any .Net code example reference will be preferred.

Thanks

Hello There,


Thanks for contacting support.

We are looking into your request. We will update you with some definite response in a while.

Best Regards,


Hi,


Thanks for contacting support.

Please visit the following link for information on how to Find whether PDF file contains images or text only.

Furthermore, in order to convert non-searchable PDF file (scanned image PDF) to searchable PDF document, please try using following code snippet with Tesseract.

In case you face any issue, please share the sample PDF files, so that we can further look into this matter.

Document doc = new Document();<o:p></o:p>

doc = new Document(“D:/Downloads/input.pdf”);<o:p></o:p>

doc.Convert(CallBackGetHocr);<o:p></o:p>

doc.Save(“E:/Data/pdf_searchable.pdf”);<o:p></o:p>

}<o:p></o:p>

static string CallBackGetHocr(System.Drawing.Image img)<o:p></o:p>

{<o:p></o:p>

string dir = @“E:\Data”;<o:p></o:p>

img.Save(dir + “ocrtest.jpg”);<o:p></o:p>

///V3.02<o:p></o:p>

ProcessStartInfo info = new ProcessStartInfo(@“C:\Program Files (x86)\Tesseract-OCR\tesseract.exe”);<o:p></o:p>

info.WindowStyle = ProcessWindowStyle.Hidden;<o:p></o:p>

info.Arguments = @“E:\data\ocrtest.jpg E:\data\out hocr”;<o:p></o:p>

Process p = new Process();<o:p></o:p>

p.StartInfo = info;<o:p></o:p>

p.Start();<o:p></o:p>

p.WaitForExit();<o:p></o:p>

StreamReader streamReader = new StreamReader(@“E:\data\out.html”);<o:p></o:p>

string text = streamReader.ReadToEnd();<o:p></o:p>

streamReader.Close();<o:p></o:p>

return text;<o:p></o:p>

}