Hello,
I need to know the X and Y position of the PDF that is currently being displayed.
I can find these while debugging in the ViewChanged event via the following 2 properties:
e.CurrentView.PageStartXPos
e.CurrentView.PageStartYPos
(e = ceTe.DynamicPDF.Viewer.ViewChangedEventArgs)
However, these properties are neither available at designtime nor via reflection.
How can I get the values of these properties?
Kind regards,
Martijn
How to read View Properties at runtime
Re: How to read View Properties at runtime
Forum member · Jan 3, 2014Already fixed it. I was trying to read them using GetProperty which didn't work. Using GetField I can successfully read the values of the X and Y positions.
However, as a followup question: is there any way to get the size of the actual pdf on screen? Only the size of the pdf is needed, so the size without any padding or menus.
Kind regards,
Martijn
Re: How to read View Properties at runtime
Support · Jan 3, 2014Hello,
You can retrieve the actual size of the PDF by setting the ZoomMode to actual size. Retrieve the current view and using this get the PageVisibleArea array. Build a Rectangle object using the values from PageVisibleArea array. Then you can access the Width and Height methods of the Rectangle to get the respective dimension values. Below is the sample code for it.
pdfViewer1.ZoomMode=Zoom.ActualSize;
ceTe.DynamicPDF.Viewer.View view = pdfViewer1.GetCurrentView();
PageVisibleArea[] VisibleAreas = pdfViewer1.GetPageVisibleArea(view);
float pageX = VisibleAreas[0].PixelLeft;
float pagey = VisibleAreas[0].PixelTop;
Rectangle rect=Rectangle.FromLTRB((int)VisibleAreas[0].PixelLeft,(int)VisibleAreas[0].PixelTop,(int)VisibleAreas[0].PixelRight,(int)VisibleAreas[0].PixelBottom);
float width=rect.Width;
float height=rect.Height;
Thanks,
ceTe Software Support Team.