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(InputFileName As String,
              OutputFileName As String,
              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

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