BCL easyPDF SDK
easyPDF SDK Usermanual
PDF Creator Programming API  |  Download Free Trial  |  Contact Us to Purchase

CropPages Method

Crops the content area of one or more pages in a PDF file.

void CropPages(string InputFileName,
               string OutputFileName,
               int FromPage,
               int ToPage,
               double Left,
               double Top,
               double Right,
               double Bottom)

Sub CropPages(InputFileName As String, _
              OutputFileName As String, _
              FromPage As Integer, _
              ToPage As Integer, _
              Left As Double, _
              Top As Double, _
              Right As Double, _
              Bottom As Double)

def CropPages(self,
              InputFileName,
              OutputFileName,
              FromPage,
              ToPage,
              Left,
              Top,
              Right,
              Bottom)
void CropPages(String InputFileName,
               String OutputFileName,
               int FromPage,
               int ToPage,
               double Left,
               double Top,
               double Right,
               double Bottom) throws PDFProcessorException

function CropPages($InputFileName,
                   $OutputFileName,
                   $FromPage,
                   $ToPage,
                   $Left,
                   $Top,
                   $Right,
                   $Bottom) 

BclPrcResult CropPages(const BclPDFProcessorSettings* pSettings,
                       const wchar_t* InputFileName,
                       const wchar_t* OutputFileName,
                       int FromPage,
                       int ToPage,
                       double Left,
                       double Top,
                       double Right,
                       double Bottom);
Sub CropPages(InputFileName As String, _
              OutputFileName As String, _
              FromPage As Long, _
              ToPage As Long, _
              Left As Double, _
              Top As Double, _
              Right As Double, _
              Bottom As Double)

bepproc +Crop [-mode relative|absolute]
              [-left <dimension>]
              [-top <dimension>]
              [-right <dimension>]
              [-bottom <dimension>]
              [-pages <range>]



Parameters

Return Values

N/A.

Remarks

The page numbers use zero-based indexes, meaning that the first page has a number of 0.

The crop coordinates are based on the top-left corner of the pre-cropped page, using a dimension of points. 1 point is 1/72 inch (there are 72 points in an inch). 1 inch is 25.4 millimeters.

The final page will be as wide as Right - Left and as tall as Bottom - Top, provided that the specified coordinates define a valid crop. Note that CropPages cannot expand the content, it can only shrink or keep it unchanged. The function may automatically adjust the user-specified coordinates in order to ensure that the post-crop rectangle is within the pre-crop rectangle. An error occurs if the crop would cause the page size to be 0 or negative.

Example Usage

Set oProcessor = CreateObject("easyPDF.PDFProcessor.8")
' crop the first 5 pages 1 inch on the left and top, 6x9 inches big
oProcessor.CropPages "C:\test\input.pdf", C:\test\output.pdf", 0, 4, 72, 72, 7 * 72, 10 * 72