logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Post a reply
From:
Message:

Maximum number of characters in each post is: 32767
Bold Italic Underline   Highlight Quote Choose Language for Syntax Highlighting Insert Image Insert an existing Attachment or upload a new File... Create Link   Unordered List Ordered List   Left Justify Center Justify Right Justify   Outdent Indent   More BBCode Tags
Font Color Font Size
Security Image:
Enter The Letters From The Security Image:
  Preview Post Cancel

Last 10 Posts (In reverse order)
Paul Rayman Posted: Thursday, February 16, 2017 5:00:21 PM(UTC)
 
If data files are actually placed in tessdata folder, then the last parameter of renderer.Create method must be ends with "tessdata\".

Code:

using (var renderer = OcrPdfRenderer.Create("Template_pdf_file", @"~\DigiSync\DigiSync.Manager\TemplateOutput\tessdata\"))

Akshara Posted: Friday, February 10, 2017 3:40:20 AM(UTC)
 
Thanks Paul for the help, it worked.

But I have two more queries

1.How to render Annotations on PDF and to save the PDF with that annotations?
2.I am not able to convert multiple images to a single PDF. Bellow is written code for it-
Code:

 public void PdfCreationFromImage(List<string> imagePathList)
        {

            OcrApi.LicenseKey = ConfigurationManager.AppSettings["LicenseKeyOcr"];
            using (var api = OcrApi.Create())
            {
                api.Init(Languages.English);
                //Create the renderer to PDF file output. The extension will be added automatically
                using (var renderer = OcrPdfRenderer.Create("Template_pdf_file", @"~\DigiSync\DigiSync.Manager\TemplateOutput\"))
                {
                    renderer.BeginDocument("Title");
//imagePathList is a list of image path which i want to combine to form a single PDF
                    foreach (var item in imagePathList)
                    {
                        api.ProcessPages(item, null, 0, renderer);
                    }
                    renderer.EndDocument();
                }
            }

        }


i have tried the following link provided by you to convert image to PDF but didn't work.
https://tesseract.patagames.com/
Paul Rayman Posted: Wednesday, February 8, 2017 10:08:19 PM(UTC)
 
Quote 1:
Quote:

Can you please provide me code to draw Coordinates of rectangle selected by us on PDF document in PDFViewer.

Please look at this topic
http://forum.patagames.com/posts/t272-Does-pdf-viewer-have-the-take-snapshot-functionality-as-Acrobat

Quote 2:
The GetBoundedText method takes the rectangle in PDF standard user space coordinates.
So you should convert your rectangle to page coordinate system.
Please find the ClientToPage method here: https://pdfium.patagames...c9-ed83-a4d9de8a35f8.htm



Quote 3:
Quote:

The output of bellow code is not in appropriate Human readable language,it is combination of characters,numbers and symbols.

https://github.com/tesseract-ocr/tesseract/wiki/ImproveQuality
Akshara Posted: Tuesday, February 7, 2017 10:50:09 PM(UTC)
 
Quote 1:
Selected region means Rectangle selected by using MouseDown,MouseMove,MoveUp and Paint events of pdfViewer to get the coordinates.
I have tried to get coordinates by using windows canvas method, but I am not able to get the exact coordinates of Selected rectangle considering the PDF document.
Can you please provide me code to draw Coordinates of rectangle selected by us on PDF document in PDFViewer.

Quote 2:
The output of bellow code is not the same region data of which I have given the coordinates,I am getting data which is not selected. I am not able to get the exact data from the rectangle drawn over PDF.
Code is bellow:

Code:

 foreach (var itemdata in pdflist)
            {
                Ocr ocr = new Ocr();
                InitWebApp();
                using (var doc = PdfDocument.Load(itemdata))
                {
                    using (var page = doc.Pages[0])
                    {
                        templateId = Convert.ToInt32(cmbSelTemplate.SelectedValue);
                        List<Ocr> tempMetadata = mapperController.GetOcrMetadata(templateId);//templateMetadata gets the list of coordinates i.e. left,top,right,bottom
                        //delcare a dict with key and value string key-name
                        Dictionary<string, string> ocrTemp = new Dictionary<string, string>();
                        foreach (var item in tempMetadata)
                        {
                            var textInfo = page.Text.GetBoundedText(Convert.ToInt32(item.Left ), Convert.ToInt32(item.Top), Convert.ToInt32((item.Right - item.Left) ), Convert.ToInt32((item.Bottom - item.Top) ));
                            ocrTemp.Add(item.Name, textInfo);
                        }
                        CreateXML(itemdata, ocrTemp);
                    }
                }
            }




Quote 3:
The output of bellow code is not in appropriate Human readable language,it is combination of characters,numbers and symbols.I am not able to get the exact data from the rectangle drawn over PDF.
Code is bellow:
Code:

 OcrApi.LicenseKey = ConfigurationManager.AppSettings["LicenseKeyOcr"];
            using (var api = OcrApi.Create())
            {
                templateId = Convert.ToInt32(cmbSelTemplate.SelectedValue);
                List<Ocr> tempMetadata = mapperController.GetOcrMetadata(templateId);
                foreach (var item in tempMetadata)
                {
                    api.Init(Languages.English);
                   
                    var rect = new Rectangle(Convert.ToInt32(item.Left), Convert.ToInt32(item.Top), Convert.ToInt32((item.Right - item.Left)), Convert.ToInt32((item.Bottom - item.Top)));
                    
                    string plainText = api.GetTextFromImage(filepath, rect.Location.X,rect.Location.Y,rect.Size.Width,rect.Size.Height);
                   ocrTemp.Add(item.Name, plainText);
                }
                return ocrTemp;
            }
Paul Rayman Posted: Tuesday, February 7, 2017 4:40:01 PM(UTC)
 
Originally Posted by: Akshara Go to Quoted Post
1) I am not able to get coordinates of selected region in PDF using Pdfium pdf viewer

What exactly you mean when you say "selected region"?
Quote:

2) I am not able to extract data from respective selected coordinate using "GetBoundedText(float left, float top, float right, float bottom)" function

Please let me see your code.
Quote:

3) I am no able to extract data from selected region in image by passing coordinates to function "GetTextFromImage(filepath, rect.Location.X,rect.Location.Y,rect.Size.Width,rect.Size.Height)".

Pdfium has now any methods named "GetTextFromImage"


Akshara Posted: Tuesday, February 7, 2017 4:58:25 AM(UTC)
 
1) I am not able to get coordinates of selected region in PDF using Pdfium pdf viewer
2) I am not able to extract data from respective selected coordinate using "GetBoundedText(float left, float top, float right, float bottom)" function
3) I am no able to extract data from selected region in image by passing coordinates to function "GetTextFromImage(filepath, rect.Location.X,rect.Location.Y,rect.Size.Width,rect.Size.Height)".



above are my issues please provide me with solution.