Some test text!

Crop pages

Cropping PDF pages in PHP

To crop a page in a PDF document.

$doc = new PDFDoc($filename);

// Access a PDF page
$page = $doc->GetPage(1);

// Crop the page
$page->SetCropBox(new Rect(0, 0, 500, 600))

About cropping the page

The crop box defines the region to which the contents of the page are to be clipped (cropped) when displayed or printed. Unlike other types of boxes, the crop box has no defined meaning in terms of physical page geometry or intended use; it merely imposes clipping on the page contents. The default value is the page's media box. A new crop box can be imposed on a page with Page.SetCropBox().

Get the answers you need: Support

Upcoming Webinar: PDFTron SDK Tech Review | Nov 29, 2022 at 2 pm ET


The Platform


© 2022 PDFTron Systems Inc. All rights reserved.


Terms of Use