Reference Guide
GdPicture14.WPF Namespace / GdViewer Class / GetPageBounds Method
Output parameter. The horizontal (X) coordinate (0-based) of the top left point, in pixels, within the viewer area, where the top left point of the displayed page is located.
Output parameter. The vertical (Y) coordinate (0-based) of the top left point, in pixels, within the viewer area, where the top left point of the displayed page is located.
Output parameter. The width, in pixels, of the viewer area, which is covered by the currently displayed page.
Output parameter. The height, in pixels, of the viewer area, which is covered by the currently displayed page.
Example





In This Topic
    GetPageBounds Method
    In This Topic
    Returns coordinates and dimensions, in pixels, of the viewer area, which is covered by the current page of the document displayed in the GdViewer control. Be aware that the resulting coordinate may be negative if the currently displayed page is shifted outside the viewer area.
    Syntax
    'Declaration
     
    
    Public Sub GetPageBounds( _
       ByRef Left As Double, _
       ByRef Top As Double, _
       ByRef Width As Double, _
       ByRef Height As Double _
    ) 
    public void GetPageBounds( 
       ref double Left,
       ref double Top,
       ref double Width,
       ref double Height
    )
    public procedure GetPageBounds( 
       var  Left: Double;
       var  Top: Double;
       var  Width: Double;
       var  Height: Double
    ); 
    public function GetPageBounds( 
       Left : double,
       Top : double,
       Width : double,
       Height : double
    );
    public: void GetPageBounds( 
       ref double Left,
       ref double Top,
       ref double Width,
       ref double Height
    ) 
    public:
    void GetPageBounds( 
       double% Left,
       double% Top,
       double% Width,
       double% Height
    ) 

    Parameters

    Left
    Output parameter. The horizontal (X) coordinate (0-based) of the top left point, in pixels, within the viewer area, where the top left point of the displayed page is located.
    Top
    Output parameter. The vertical (Y) coordinate (0-based) of the top left point, in pixels, within the viewer area, where the top left point of the displayed page is located.
    Width
    Output parameter. The width, in pixels, of the viewer area, which is covered by the currently displayed page.
    Height
    Output parameter. The height, in pixels, of the viewer area, which is covered by the currently displayed page.
    Remarks
    You can regularly apply the GetStat method to determine if this method has been successful.

    Just to remind you, that this coordinate is 0-based with the origin being in the top left corner of the viewer area and it is related to the current page determined by the CurrentPage property.

    Example
    How to find out the viewer area covered with the currently displayed page.
    'We assume that the GdViewer1 control has been properly integrated
    'and your document has been properly displayed as well.
    Dim l1 As Double = 0, t1 As Double = 0, w1 As Double = 0, h1 As Double = 0
    GdViewer1.GetDisplayedArea(l1, t1, w1, h1)
    Dim l2 As Double = 0, t2 As Double = 0, w2 As Double = 0, h2 As Double = 0
    GdViewer1.GetPageBounds(l2, t2, w2, h2)
    MessageBox.Show("Displayed area: X , Y = " + l1.ToString("N2") + " , " + t1.ToString("N2") + "  w=" + w1.ToString("N2") + "  h=" + h1.ToString("N2") + vbCrLf +
                    "Page bounds: X , Y = " + l2.ToString("N2") + " , " + t2.ToString("N2") + "  w=" + w2.ToString("N2") + "  h=" + h2.ToString("N2"), "GdViewer1.GetPageBounds")
    //We assume that the GdViewer1 control has been properly integrated
    //and your document has been properly displayed as well.
    double l1 = 0, t1= 0, w1 = 0, h1 = 0;
    GdViewer1.GetDisplayedArea(ref l1, ref t1, ref w1, ref h1);
    double l2 = 0, t2 = 0, w2 = 0, h2 = 0;
    GdViewer1.GetPageBounds(ref l2, ref t2, ref w2, ref h2);
    MessageBox.Show("Displayed area: X , Y = " + l1.ToString("N2") + " , " + t1.ToString("N2") + "  w=" + w1.ToString("N2") + "  h=" + h1.ToString("N2") +
                    "\nPage bounds: X , Y = " + l2.ToString("N2") + " , " + t2.ToString("N2") + "  w=" + w2.ToString("N2") + "  h=" + h2.ToString("N2"), "GdViewer1.GetPageBounds");
    See Also