GetPageBox Method (GdPicturePDF)
                                 
                                
                                    
                                        In This Topic
                                    
                                
                                Returns the boundaries, expressed in the current units used in this document, of the specified page box of the currently selected page of the loaded PDF document. 
You can simply use the GdPicturePDF.GetMeasurementUnit method to determine the currently defined units or you can easily use the GdPicturePDF.SetMeasurementUnit method to reset the units according to your preference.
 
            
            
            Syntax
            
            
            
            
            'Declaration
 
Public Function GetPageBox( _
   ByVal  As PdfPageBox, _
   ByRef  As Single, _
   ByRef  As Single, _
   ByRef  As Single, _
   ByRef  As Single _
) As GdPictureStatus
             
        
            
            public GdPictureStatus GetPageBox( 
   PdfPageBox ,
   ref float ,
   ref float ,
   ref float ,
   ref float 
)
             
        
            
            public function GetPageBox( 
    : PdfPageBox;
   var  : Single;
   var  : Single;
   var  : Single;
   var  : Single
): GdPictureStatus; 
             
        
            
            public function GetPageBox( 
    : PdfPageBox,
    : float,
    : float,
    : float,
    : float
) : GdPictureStatus;
             
        
            
            public: GdPictureStatus GetPageBox( 
   PdfPageBox ,
   ref float ,
   ref float ,
   ref float ,
   ref float 
) 
             
        
            
            public:
GdPictureStatus GetPageBox( 
   PdfPageBox ,
   float% ,
   float% ,
   float% ,
   float% 
) 
             
        
             
        
            Parameters
- PageBox
 
- The required page (boundary) box. A member of the PdfPageBox enumeration.
 - Left
 
- Output parameter. The horizontal (X) coordinate of the top left point of the specified page box expressed in the current units specified by the SetMeasurementUnit method.
 - Top
 
- Output parameter. The vertical (Y) coordinate of the top left point of the specified page box expressed in the current units specified by the SetMeasurementUnit method.
 - Right
 
- Output parameter. The horizontal (X) coordinate of the bottom right point of the specified page box expressed in the current units specified by the SetMeasurementUnit method.
 - Bottom
 
- Output parameter. The vertical (Y) coordinate of the bottom right point of the specified page box expressed in the current units specified by the SetMeasurementUnit method.
 
            
            Return Value
A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK. 
We strongly recommend always checking this status first.
 
            
            
            
            
            
            Example
How to obtain the mediabox and the cropbox boundaries of the first page in your document.
             
             
             
             
    
	
		Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
    Dim message As String = ""
    gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter)
    status = gdpicturePDF.SelectPage(1)
    If status = GdPictureStatus.OK Then
        Dim left As Single = 0, top As Single = 0, right As Single = 0, bottom As Single = 0
        status = gdpicturePDF.GetPageBox(PdfPageBox.PdfPageBoxMediaBox, left, top, right, bottom)
        If status = GdPictureStatus.OK Then
            message = message + "The mediabox for the first page is defined like this:" + vbCrLf + "( " + left.ToString() + " ; " + top.ToString() +
                                " ) - ( " + right.ToString() + " ; " + bottom.ToString() + " ) millimeters."
        Else
            message = message + "The GetPageBox() method for mediabox has failed with the status: " + status.ToString()
        End If
            
        status = gdpicturePDF.GetPageBox(PdfPageBox.PdfPageBoxCropBox, left, top, right, bottom)
        If status = GdPictureStatus.OK Then
            message = message + vbCrLf + "The cropbox  for the first page is defined like this:" + vbCrLf + "( " + Left.ToString() + " ; " + top.ToString() +
                                         " ) - ( " + right.ToString() + " ; " + bottom.ToString() + " ) millimeters."
        Else
            message = message + vbCrLf + "The GetPageBox() method for cropbox has failed with the status: " + status.ToString()
        End If
    Else
        message = message + "The SelectPage() method has failed with the status: " + status.ToString()
    End If
    MessageBox.Show(message, "Example: GetPageBox")
Else
    MessageBox.Show("The file can't be loaded.", "Example: GetPageBox")
End If
gdpicturePDF.Dispose()
	 
	
		GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
    string message = "";
    gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter);
    status = gdpicturePDF.SelectPage(1);
    if (status == GdPictureStatus.OK)
    {
        float left = 0, top = 0, right = 0, bottom = 0;
        status = gdpicturePDF.GetPageBox(PdfPageBox.PdfPageBoxMediaBox, ref left, ref top, ref right, ref bottom);
        if (status == GdPictureStatus.OK)
        {
            message = message + "The mediabox for the first page is defined like this:\n( " + left.ToString() + " ; " + top.ToString() +
                                " ) - ( " + right.ToString() + " ; " + bottom.ToString() + " ) millimeters.";
        }
        else
            message = message + "The GetPageBox() method for mediabox has failed with the status: " + status.ToString();
            
        status = gdpicturePDF.GetPageBox(PdfPageBox.PdfPageBoxCropBox, ref left, ref top, ref right, ref bottom);
        if (status == GdPictureStatus.OK)
        {
            message = message + "\nThe cropbox  for the first page is defined like this:\n( " + left.ToString() + " ; " + top.ToString() +
                                " ) - ( " + right.ToString() + " ; " + bottom.ToString() + " ) millimeters.";
            
        }
        else
            message = message + "\nThe GetPageBox() method for cropbox has failed with the status: " + status.ToString();
    }
    else
        message = message + "The SelectPage() method has failed with the status: " + status.ToString();
    MessageBox.Show(message, "Example: GetPageBox");
}
else
    MessageBox.Show("The file can't be loaded.", "Example: GetPageBox");
gdpicturePDF.Dispose();
	 
	
 
 
            
            Example
How to obtain the mediabox and the cropbox boundaries of the first page in your document.
             
             Dim gdpicturePDF As New GdPicturePDF()
             Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
             If status = GdPictureStatus.OK Then
                 Dim message As String = ""
                 gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter)
                 status = gdpicturePDF.SelectPage(1)
                 If status = GdPictureStatus.OK Then
                     Dim left As Single = 0, top As Single = 0, right As Single = 0, bottom As Single = 0
                     status = gdpicturePDF.GetPageBox(PdfPageBox.PdfPageBoxMediaBox, left, top, right, bottom)
                     If status = GdPictureStatus.OK Then
                         message = message + "The mediabox for the first page is defined like this:" + vbCrLf + "( " + left.ToString() + " ; " + top.ToString() +
                                             " ) - ( " + right.ToString() + " ; " + bottom.ToString() + " ) millimeters."
                     Else
                         message = message + "The GetPageBox() method for mediabox has failed with the status: " + status.ToString()
                     End If
            
                     status = gdpicturePDF.GetPageBox(PdfPageBox.PdfPageBoxCropBox, left, top, right, bottom)
                     If status = GdPictureStatus.OK Then
                         message = message + vbCrLf + "The cropbox  for the first page is defined like this:" + vbCrLf + "( " + Left.ToString() + " ; " + top.ToString() +
                                                      " ) - ( " + right.ToString() + " ; " + bottom.ToString() + " ) millimeters."
                     Else
                         message = message + vbCrLf + "The GetPageBox() method for cropbox has failed with the status: " + status.ToString()
                     End If
                 Else
                     message = message + "The SelectPage() method has failed with the status: " + status.ToString()
                 End If
                 MessageBox.Show(message, "Example: GetPageBox")
             Else
                 MessageBox.Show("The file can't be loaded.", "Example: GetPageBox")
             End If
             gdpicturePDF.Dispose()
             
             GdPicturePDF gdpicturePDF = new GdPicturePDF();
             GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
             if (status == GdPictureStatus.OK)
             {
                 string message = "";
                 gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter);
                 status = gdpicturePDF.SelectPage(1);
                 if (status == GdPictureStatus.OK)
                 {
                     float left = 0, top = 0, right = 0, bottom = 0;
                     status = gdpicturePDF.GetPageBox(PdfPageBox.PdfPageBoxMediaBox, ref left, ref top, ref right, ref bottom);
                     if (status == GdPictureStatus.OK)
                     {
                         message = message + "The mediabox for the first page is defined like this:\n( " + left.ToString() + " ; " + top.ToString() +
                                             " ) - ( " + right.ToString() + " ; " + bottom.ToString() + " ) millimeters.";
                     }
                     else
                         message = message + "The GetPageBox() method for mediabox has failed with the status: " + status.ToString();
            
                     status = gdpicturePDF.GetPageBox(PdfPageBox.PdfPageBoxCropBox, ref left, ref top, ref right, ref bottom);
                     if (status == GdPictureStatus.OK)
                     {
                         message = message + "\nThe cropbox  for the first page is defined like this:\n( " + left.ToString() + " ; " + top.ToString() +
                                             " ) - ( " + right.ToString() + " ; " + bottom.ToString() + " ) millimeters.";
            
                     }
                     else
                         message = message + "\nThe GetPageBox() method for cropbox has failed with the status: " + status.ToString();
                 }
                 else
                     message = message + "The SelectPage() method has failed with the status: " + status.ToString();
                 MessageBox.Show(message, "Example: GetPageBox");
             }
             else
                 MessageBox.Show("The file can't be loaded.", "Example: GetPageBox");
             gdpicturePDF.Dispose();
             
            
            
            See Also