pdfviewer Highlighting being obscured by text layer

6 posts, 0 answers
  1. Michael
    Michael avatar
    7 posts
    Member since:
    Sep 2012

    Posted 06 Jun 2014 Link to this post

    I am trying to draw a box over the PDF in the viewer. Basically the same as what is done in the customUILayer application (written by telerik to demo how to highlight text on a PDF).


    This works for most PDF but not for the attached PDF (note* rename 26982.png to 26982.pdf)

    The attached picture indicates the problem. The PDF text layer seems to be sitting above the highlighted box. I have tried to change the ZIndex of the box that i am adding but without success.

    If you use the customUIlayer  (http://www.telerik.com/forums/text-selection-and-highlight) application, load in the PDF then try to highlight the text you will see the problem (the text does not get highlighted).

    thanks,
    michael.


  2. Michael
    Michael avatar
    7 posts
    Member since:
    Sep 2012

    Posted 06 Jun 2014 in reply to Michael Link to this post

    let me try to add the pdf again (note* rename 26982.png to 26982.pdf)
  3. DevCraft banner
  4. Kammen
    Admin
    Kammen avatar
    312 posts

    Posted 11 Jun 2014 Link to this post

    Hello Michael,

    Thank you for the interest in RadPdfViewer.

    The PDF content is not separated on text, graphics, highlights, etc. It consists of a flat single layer content that overlaps. This means that you cannot inset custom layer between the text and the background. The two options you have are to insert a layer below the content (as shown in the demo, then the PDF content will be placed above that layer's content), or above (the layer's content will be placed above the PDF content).

    In your case you could try to insert the custom layer above the content, and make the highlights transparent. This will make both content and highlights visible.

    Hope this answers your question.

    Regards,
    Kammen
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  5. Michael
    Michael avatar
    7 posts
    Member since:
    Sep 2012

    Posted 11 Jun 2014 in reply to Kammen Link to this post

    Thanks,

    how do make the highlights layer appear above the PDF. I have tried playing with the  zindex of the canvas but this did not seem to work.


    eg.

      Rectangle r = new Rectangle()
                                  {


                                      Width = b.width * scalex,
                                      Height = b.height * scaley,
                                      StrokeThickness = 1,
                                      Fill = new SolidColorBrush(Color.FromArgb(128, 0, 255, 0))

                                  };
                                this.container.Children.Add(r);
                                double x = b.x * scalex;
                                double y = b.y * scaley;
                                Canvas.SetLeft(r, x);
                                Canvas.SetTop(r, y);
    //then i set the z index
                             Canvas.SetZIndex(r, 100);


    thanks.
  6. Kammen
    Admin
    Kammen avatar
    312 posts

    Posted 11 Jun 2014 Link to this post

    Hello Michael,

    You can use the following code in the BuildUILayersOverride method of your UILayersBuilder (CustomUILayersBuilder class in the demo).

    uiLayerContainer.UILayers.AddAfter(DefaultUILayers.ContentElementsUILayer, myCustomLayer);


    Regards,
    Kammen
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  7. Michael
    Michael avatar
    7 posts
    Member since:
    Sep 2012

    Posted 11 Jun 2014 in reply to Kammen Link to this post

    Thanks that solves my problem.
Back to Top
DevCraft banner