GdPicture.NET.14.API
GdPicture14 Namespace / GdPicturePDF Class / AutoCropPage Method / AutoCropPage(Single,Single,Single,Single,Boolean) Method
Specifies the width of the left margin for the cropped content.
Sets the height of the top margin for the cropped content.
Sets the width of the right margin for the cropped content.
Sets the height of the bottom margin for the cropped content.
Set this parameter to true in order to make the algorithm ignore white rectangle objects on page. Otherwise set to false.
Example





In This Topic
AutoCropPage(Single,Single,Single,Single,Boolean) Method
In This Topic
Automaticaly crops currently selected page of loaded PDF document based on page content.
Syntax
'Declaration
 
Public Overloads Function AutoCropPage( _
   ByVal MarginLeft As Single, _
   ByVal MarginTop As Single, _
   ByVal MarginRight As Single, _
   ByVal MarginBottom As Single, _
   ByVal IgnoreWhiteRectangles As Boolean _
) As GdPictureStatus
public GdPictureStatus AutoCropPage( 
   float MarginLeft,
   float MarginTop,
   float MarginRight,
   float MarginBottom,
   bool IgnoreWhiteRectangles
)
public function AutoCropPage( 
    MarginLeft: Single;
    MarginTop: Single;
    MarginRight: Single;
    MarginBottom: Single;
    IgnoreWhiteRectangles: Boolean
): GdPictureStatus; 
public function AutoCropPage( 
   MarginLeft : float,
   MarginTop : float,
   MarginRight : float,
   MarginBottom : float,
   IgnoreWhiteRectangles : boolean
) : GdPictureStatus;
public: GdPictureStatus AutoCropPage( 
   float MarginLeft,
   float MarginTop,
   float MarginRight,
   float MarginBottom,
   bool IgnoreWhiteRectangles
) 
public:
GdPictureStatus AutoCropPage( 
   float MarginLeft,
   float MarginTop,
   float MarginRight,
   float MarginBottom,
   bool IgnoreWhiteRectangles
) 

Parameters

MarginLeft
Specifies the width of the left margin for the cropped content.
MarginTop
Sets the height of the top margin for the cropped content.
MarginRight
Sets the width of the right margin for the cropped content.
MarginBottom
Sets the height of the bottom margin for the cropped content.
IgnoreWhiteRectangles
Set this parameter to true in order to make the algorithm ignore white rectangle objects on page. Otherwise set to false.

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.

Remarks
This method is only allowed for use with non-encrypted documents.

Be aware that the values of coordinates and dimensions are expressed in the current units defined by the GdPicturePDF.SetMeasurementUnit method.

Example
How to AutoCrop specified page of loaded PDF document. using(GdPicturePDF gdpicturePDF = New GdPicturePDF()) { gdpicturePDF.LoadFromFile("sample.pdf"); gdpicturePDF.AutoCropPage(0, 0, 0, 0, true); gdpicturePDF.SaveToFile("sample_cropped.pdf"); }
Using gdpicturePDF = New GdPicturePDF()
    gdpicturePDF.LoadFromFile("sample.pdf")
    gdpicturePDF.AutoCropPage(0, 0, 0, 0, True)
    gdpicturePDF.SaveToFile("sample_cropped.pdf")
End Using

	
See Also