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

pdfviewer Highlighting being obscured by text layer

5 Answers 281 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 06 Jun 2014, 05:08 AM
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.


5 Answers, 1 is accepted

Sort by
0
Michael
Top achievements
Rank 1
answered on 06 Jun 2014, 05:12 AM
let me try to add the pdf again (note* rename 26982.png to 26982.pdf)
0
Kammen
Telerik team
answered on 11 Jun 2014, 08:05 AM
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.
 
0
Michael
Top achievements
Rank 1
answered on 11 Jun 2014, 09:56 AM
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.
0
Kammen
Telerik team
answered on 11 Jun 2014, 11:20 AM
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.
 
0
Michael
Top achievements
Rank 1
answered on 12 Jun 2014, 12:27 AM
Thanks that solves my problem.
Tags
PDFViewer
Asked by
Michael
Top achievements
Rank 1
Answers by
Michael
Top achievements
Rank 1
Kammen
Telerik team
Share this question
or