SetPageBox Method (GdPicturePDF)
 
            
                In This Topic
            
            Sets the new boundaries, expressed in the current units used in this document, of the required 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 SetPageBox( _
   ByVal  As PdfPageBox, _
   ByVal  As Single, _
   ByVal  As Single, _
   ByVal  As Single, _
   ByVal  As Single _
) As GdPictureStatus
             
        
            
            public GdPictureStatus SetPageBox( 
   PdfPageBox ,
   float ,
   float ,
   float ,
   float 
)
             
        
            
            public function SetPageBox( 
    : PdfPageBox;
    : Single;
    : Single;
    : Single;
    : Single
): GdPictureStatus; 
             
        
            
            public function SetPageBox( 
    : PdfPageBox,
    : float,
    : float,
    : float,
    : float
) : GdPictureStatus;
             
        
            
            public: GdPictureStatus SetPageBox( 
   PdfPageBox ,
   float ,
   float ,
   float ,
   float 
) 
             
        
            
            public:
GdPictureStatus SetPageBox( 
   PdfPageBox ,
   float ,
   float ,
   float ,
   float 
) 
             
        
             
        
            Parameters
- PageBox
 
- The required page (boundary) box. A member of the PdfPageBox enumeration.
 - Left
 
- The newly defined horizontal (X) coordinate of the top left point of the specified page box expressed in the current units specified by the SetMeasurementUnit method.
 - Top
 
- The newly defined vertical (Y) coordinate of the top left point of the specified page box expressed in the current units specified by the SetMeasurementUnit method.
 - Right
 
- The newly defined horizontal (X) coordinate of the bottom right point of the specified page box expressed in the current units specified by the SetMeasurementUnit method.
 - Bottom
 
- The newly defined 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 reset the cropbox boundaries of the cloned 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.ClonePage(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.PdfPageBoxCropBox, left, top, right, bottom)
        If status = GdPictureStatus.OK Then
            status = gdpicturePDF.SetPageBox(PdfPageBox.PdfPageBoxCropBox, left + 10, top - 10, right - 10, bottom + 10)
            If status = GdPictureStatus.OK Then
                If status = GdPictureStatus.OK Then
                    If gdpicturePDF.SaveToFile("test_SetPageBox.pdf") = GdPictureStatus.OK Then
                        message = message + "The example has been followed successfully and file has been saved."
                    Else
                        message = message + "The example has been followed successfully but the file can't be saved."
                    End If
            
                End If
            Else
                message = message + "The SetPageBox() method has failed with the status: " + status.ToString()
            End If
            Else
            message = message + "The GetPageBox() method has failed with the status: " + status.ToString()
        End If
    Else
        message = message + "The ClonePage() 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: SetPageBox")
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.ClonePage(1);
    if (status == GdPictureStatus.OK)
    {
        float left = 0, top = 0, right = 0, bottom = 0;
        status = gdpicturePDF.GetPageBox(PdfPageBox.PdfPageBoxCropBox, ref left, ref top, ref right, ref bottom);
        if (status == GdPictureStatus.OK)
        {
            status = gdpicturePDF.SetPageBox(PdfPageBox.PdfPageBoxCropBox, left + 10, top - 10, right - 10, bottom + 10);
            if (status == GdPictureStatus.OK)
            {
                if (status == GdPictureStatus.OK)
                {
                    if (gdpicturePDF.SaveToFile("test_SetPageBox.pdf") == GdPictureStatus.OK)
                        message = message + "The example has been followed successfully and file has been saved.";
                    else
                        message = message + "The example has been followed successfully but the file can't be saved.";
                }
            
            }
            else
                message = message + "The SetPageBox() method has failed with the status: " + status.ToString();
        }
        else
            message = message + "The GetPageBox() method has failed with the status: " + status.ToString();
    }
    else
        message = message + "The ClonePage() method has failed with the status: " + status.ToString();
    MessageBox.Show(message, "Example: GetPageBox");
}
else
    MessageBox.Show("The file can't be loaded.", "Example: SetPageBox");
gdpicturePDF.Dispose();
	 
	
 
 
            
            Example
How to reset the cropbox boundaries of the cloned 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.ClonePage(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.PdfPageBoxCropBox, left, top, right, bottom)
                     If status = GdPictureStatus.OK Then
                         status = gdpicturePDF.SetPageBox(PdfPageBox.PdfPageBoxCropBox, left + 10, top - 10, right - 10, bottom + 10)
                         If status = GdPictureStatus.OK Then
                             If status = GdPictureStatus.OK Then
                                 If gdpicturePDF.SaveToFile("test_SetPageBox.pdf") = GdPictureStatus.OK Then
                                     message = message + "The example has been followed successfully and file has been saved."
                                 Else
                                     message = message + "The example has been followed successfully but the file can't be saved."
                                 End If
            
                             End If
                         Else
                             message = message + "The SetPageBox() method has failed with the status: " + status.ToString()
                         End If
                         Else
                         message = message + "The GetPageBox() method has failed with the status: " + status.ToString()
                     End If
                 Else
                     message = message + "The ClonePage() 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: SetPageBox")
             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.ClonePage(1);
                 if (status == GdPictureStatus.OK)
                 {
                     float left = 0, top = 0, right = 0, bottom = 0;
                     status = gdpicturePDF.GetPageBox(PdfPageBox.PdfPageBoxCropBox, ref left, ref top, ref right, ref bottom);
                     if (status == GdPictureStatus.OK)
                     {
                         status = gdpicturePDF.SetPageBox(PdfPageBox.PdfPageBoxCropBox, left + 10, top - 10, right - 10, bottom + 10);
                         if (status == GdPictureStatus.OK)
                         {
                             if (status == GdPictureStatus.OK)
                             {
                                 if (gdpicturePDF.SaveToFile("test_SetPageBox.pdf") == GdPictureStatus.OK)
                                     message = message + "The example has been followed successfully and file has been saved.";
                                 else
                                     message = message + "The example has been followed successfully but the file can't be saved.";
                             }
            
                         }
                         else
                             message = message + "The SetPageBox() method has failed with the status: " + status.ToString();
                     }
                     else
                         message = message + "The GetPageBox() method has failed with the status: " + status.ToString();
                 }
                 else
                     message = message + "The ClonePage() method has failed with the status: " + status.ToString();
                 MessageBox.Show(message, "Example: GetPageBox");
             }
             else
                 MessageBox.Show("The file can't be loaded.", "Example: SetPageBox");
             gdpicturePDF.Dispose();
             
            
            
            See Also