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.

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

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.7")
Set oProcessorHandle = oProcessor.OpenFile("C:\input.pdf", "C:\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:\input.pdf", "C:\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:\input.pdf", @"C:\input.pdf", null);
    oProcessorHandle.CropPages(0, 4, 
                               72, 72, 7 * 72, 10 * 72);
 oProcessorHandle.Close();