|
|
Originally Posted by: eagleview  Hi Paul, But how can I now highlight the OCR text in the viewer. The application highlights keywords in the PDF and works fine when it is a text PDF. But how does the PdfViewer highlight method work on an Tesseract OCR?
I can recommend to create searchable PDF via Tesseract and then load it into PdfViewer Originally Posted by: eagleview  A related question concerns your use of scaling factor in the code you provided.
answer here
|
|
|
Hi Paul,
Below is the code that you provided as an example. It works well and I figured out why the PdfViewer as displaying a gray box after the render. It seems I have to display the image PDF with the viewer and separately OCR the document. But how can I now highlight the OCR text in the viewer. The application highlights keywords in the PDF and works fine when it is a text PDF. But how does the PdfViewer highlight method work on an Tesseract OCR?
A related question concerns your use of scaling factor in the code you provided. In the PDFium User info there is an example of render but without scaling the height and width. Your example uses a scaling factor. What is the purpose of the scaling factor? This may be important because the OCR routine is not finding small characters. Even though the PDF is high quality image, Tesseract is missing some characters (U.S. becomes US. for example). Will increasing the scaling factor help?
Also, does PDF user space mean Points (1/72)? I've tried a number of different PDFs and all have a width of 612 and height of 792 no matter where the PDF comes from...I've also changed the PDFViewer and ScrollViewer sizes in the XMAL file (designer) and still I have same size of 612 and 792. My goal is to figure out the different coordinate systems in the PDF & WPF controls. I'm figuring that the scaling factor is for the 3 bytes per pixel (but not sure).
Thanks!!
using (var doc = PdfDocument.Load(@"d:\1\1.pdf")) { foreach(var page in doc.Pages) { int width = (int)(page.Width * scaleFactor); int height = (int)(page.Height * scaleFactor); using (var bitmap = new PdfBitmap(width, height, true)) { page.Render(bitmap, 0, 0, width, height, PageRotate.Normal, RenderFlags.FPDF_LCD_TEXT); string text = ocr.GetTextFromImage(bitmap.Image as Bitmap); } } }
|
|
|
Originally Posted by: eagleview  Hi,
I've used page.Render to render a page from an image pdf for OCR. How do I display the rendered page back to the PdfViewer window?
Hi, What for? PdfViewer render pages itself
|
|
|
Hi,
I've used page.Render to render a page from an image pdf for OCR. How do I display the rendered page back to the PdfViewer window?
I'm getting a gray box in place of the PdfViewer. The Pdf displays fine before I call page.render. I've tried page.GenerateContent() and that did not work. BTW - is there more examples available? Other that the initial usage page on how to add Pdfium to VS, I only can find the SDK methods but no examples on how to use most of the methods.
Thanks,
Michael
|
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close