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(int From,
               int To,
               double Left,
               double Top,
               double Right,
               double Bottom)

Sub CropPages(From As Integer, _
              To As Integer, _
              Left As Double, _
              Top As Double, _
              Right As Double, _
              Bottom As Double)

def CropPages(self, From, To, Left, Top, Right, Bottom)






void CropPages(int From,
               int To,
               double Left,
               double Top,
               double Right,
               double Bottom) throws PDFProcessorException

function CropPages($From, $To, $Left, $Top, $Right, $Bottom) 






BclPrcResult CropPages(BclPDFProcessorHandle* pHandle,
                       int From,
                       int To,
                       double Left,
                       double Top,
                       double Right,
                       double Bottom);
Sub CropPages(From As Long, _
              To 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 in VBScript

Set oProcessor = CreateObject("easyPDF.PDFProcessor.8")
Set oProcessorHandle = oProcessor.OpenFile("C:\test\input.pdf", "C:\test\input.pdf") 

' crop the first 5 pages 1 inch on the left and top, 6x9 inches big
oProcessorHandle.CropPages 0, 4, 72, 72, 7 * 72, 10 * 72

oProcessorHandle.Close

Example Usage in VB.NET

Dim oProcessor As PDFProcessor = New PDFProcessor
Dim oProcessorHandle As PDFProcessorHandle = oProcessor.OpenFile("C:\test\input.pdf", "C:\test\input.pdf")

oProcessorHandle.CropPages(0, 4, 72, 72, 7 * 72, 10 * 72)

oProcessorHandle.Close()

Example Usage in C#

PDFProcessor oProcessor = new PDFProcessor();
PDFProcessorHandle oProcessorHandle = oProcessor.OpenFile(@"C:\test\input.pdf", @"C:\test\input.pdf", null);

oProcessorHandle.CropPages(0, 4, 72, 72, 7 * 72, 10 * 72);

oProcessorHandle.Close();