Make a non searchable pdf searchable


How do i make a non searchable pdf searhable in .net?

Also how to do i make sure all text is readable by OCR?

Some samples i have used not all all the text is readable



Thanks for contacting support.

You can convert a non-searchable PDF into searchable PDF document by using following code snippet.

private static void CreateSearchablePDF(string dataDir)
 Document doc = new Document(@"C:\Users\Home\Downloads\test.pdf");

static string CallBackGetHocr(System.Drawing.Image img)
 string dir = @"E:\Data\";
 img.Save(dir + "ocrtest.jpg");
 System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(@"C:\Program Files (x86)\Tesseract-OCR\tesseract.exe");
 info.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
 info.Arguments = @"E:\data\ocrtest.jpg E:\data\out hocr";
 System.Diagnostics.Process p = new System.Diagnostics.Process();
 p.StartInfo = info;
 StreamReader streamReader = new StreamReader(@"E:\data\out.html");
 string text = streamReader.ReadToEnd();
 return text;

Above logic recognizes text for PDF images. For recognition you may use outer OCR supports HOCR standard ( ). We have used free google tesseract OCR in the above code snippet. Please install it to you computer from , after that you will have tesseract.exe console application.

In case suggested approach does not still fit your requirement, please share your sample PDF document, so that we can log an investigation ticket accordingly.


I cannot do it using this snippet. I have tried and there is no convert method in my version of apose 19.8. Plus it not exactly a clean way to do it.


There is a tesseract nuget package you can install and use that instead. Is it possible to have some more helpful examples of integrating this with aspose in the api documentation?



Could you kindly share your sample PDF document with us. We will test the scenario in our environment and share our feedback with you accordingly.