This is a migrated thread and some comments may be shown as answers.

Text selection and highlight

6 Answers 247 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 17 Jul 2012, 08:31 PM
Dear Telerik,

I can see that the pdf viewer has improved hugely over the past few months - something that I'm sure was not easy to achieve!

I'm interested in using the viewer in our application for a fairly specific purpose and need to be able to select and highlight text programmatically. (It would also be useful to add a graphical overlay, but that may be asking too much at the moment...) Is text selection + highlighting something that is possible?

Thanks, James.

6 Answers, 1 is accepted

Sort by
0
Accepted
Kammen
Telerik team
answered on 19 Jul 2012, 12:21 PM
Hi James,

Thank you for the positive feedback.

As for your question, we will need to introduce some public API in order to achieve the highlighting feature. Everything that you will need will be available with the SP that will be released around the end of the month. In addition, we will provide a demo project with simple implementation of highlighting as soon as the SP is released.

If you have further questions do not hesitate to contact us.


Kind regards,
Kammen
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
James
Top achievements
Rank 1
answered on 19 Jul 2012, 07:38 PM
That's great news.

Thanks for your answer, James.
0
Kammen
Telerik team
answered on 26 Jul 2012, 11:06 AM
Hi James,

In the just-now released 2012 Q2 SP1 you can create custom layers and add them to RadPdfViewer. Please find attached a sample project how you can create a custom layer for highlighting the selected text in the control.

If you have any questions do not hesitate to contact us again.


All the best,
Kammen
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
James
Top achievements
Rank 1
answered on 27 Jul 2012, 10:58 AM
Hi Kammen,

Thanks very much - I'll take a look at this in a couple of weeks, once we're back on development.

Best wishes, James.
0
Scott
Top achievements
Rank 1
answered on 10 Oct 2012, 02:43 PM
Is there a way to search for text on a PDF and highlight the found text?  I am looking to do something similar to the selecting text in a RadRichTextBox as seen below:

string[] searchItems = new string[] { "position", "maintenance" };
            this.radRichTextBox.Document.Selection.Clear(); // this clears the selection before processing
            DocumentTextSearch search = new DocumentTextSearch(this.radRichTextBox.Document);
            foreach (string toSearch in searchItems) {
                foreach (var textRange in search.FindAll(toSearch)) {
                    this.radRichTextBox.Document.Selection.AddSelectionStart(textRange.StartPosition);
                    this.radRichTextBox.Document.Selection.AddSelectionEnd(textRange.EndPosition);
                }
            }
0
Kammen
Telerik team
answered on 11 Oct 2012, 04:06 PM
Hello Scott,

RadPdfViewer does not support multiple selection, so it is not possible to highlight all found results unless you use a custom layer that will do the job. You can check the CustomUILayer demo that will help you understand how to use custom layers in order to highlight text.

At this point there is not a method that will return all results that match the searched text either. We will need a little time to introduce the find all functionality but it is probably going to be included in Q3 SP1 or Q1 2012.

Greetings,
Kammen
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
PDFViewer
Asked by
James
Top achievements
Rank 1
Answers by
Kammen
Telerik team
James
Top achievements
Rank 1
Scott
Top achievements
Rank 1
Share this question
or