.NET7 OcrProcessor

How do I tell the OcrProcessor how small the text can be for recognition purposes?

I have a 27 page document that contains text on every page.  Some of the text is smaller print (10px), but zooming in 6400% shows that it is "PDF text" (not image text) because it still renders it (at zoom x 64) as a page in height with perfect edges.  

The result from the OcrProcessor only shows the largest text on some of the document pages: e.g. the titles on Pages 1 & 4 and some text on page 19.  The result for all the other pages is a zero length string.  

Can I zoom the document and then OCR process it (if so how)?

Code sample follows:... 


 private static string OCRprocessPDF(string pdfIn)
 {
     //Initialize the OCR processor.
     using (OCRProcessor processor = new OCRProcessor())
     {
         //Load an existing PDF document.

         SKBitmap sKBitmap = new SKBitmap();
         FileStream stream = new FileStream(pdfIn, FileMode.Open, FileAccess.Read);
         PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument(stream);
         //Set OCR language to process.
         processor.Settings.Language = Languages.English;
         //Process OCR by providing the PDF document.
         var textFound = processor.PerformOCR(pdfLoadedDocument);
         //Close the document.
         pdfLoadedDocument.Close(true);
         return textFound;
     }
 }

3 Replies 1 reply marked as answer

KS Karmegam Seerangan Syncfusion Team September 27, 2023 03:00 PM UTC

Hi Russell,


Currently, we do not have support to recognize the documents using the zooming option. To address this issue, we kindly request you to provide detailed information about your specific needs, as well as the input documents and excepted output documents. That will be helpful for us and assist you further on this.


Regards,

Karmegam



RA Russell Antony Sherlock October 6, 2023 08:36 AM UTC

Solved. OCR only works on Image Text not Document Text. Could you kindly close this discussion.

Zooming can be achieved by using ExportAsImage with a large custom size.


Marked as answer

SS Swetha Srikumar Syncfusion Team October 9, 2023 04:50 AM UTC

Thanks for your update, please get back to us if you need any other assistance.



Loader.
Up arrow icon