Text selection and highlight

7 posts, 1 answers
  1. James
    James avatar
    117 posts
    Member since:
    Mar 2009

    Posted 17 Jul 2012 Link to this post

    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.
  2. Answer
    Kammen
    Admin
    Kammen avatar
    312 posts

    Posted 19 Jul 2012 Link to this post

    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.

  3. DevCraft banner
  4. James
    James avatar
    117 posts
    Member since:
    Mar 2009

    Posted 19 Jul 2012 Link to this post

    That's great news.

    Thanks for your answer, James.
  5. Kammen
    Admin
    Kammen avatar
    312 posts

    Posted 26 Jul 2012 Link to this post

    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.

  6. James
    James avatar
    117 posts
    Member since:
    Mar 2009

    Posted 27 Jul 2012 Link to this post

    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.
  7. Scott
    Scott avatar
    3 posts
    Member since:
    Jul 2011

    Posted 10 Oct 2012 Link to this post

    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);
                    }
                }
  8. Kammen
    Admin
    Kammen avatar
    312 posts

    Posted 11 Oct 2012 Link to this post

    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.

Back to Top
DevCraft banner