For the complete documentation index, see llms.txt. This page is also available as Markdown.

Cropping PDF pages on Server/Desktop

Requirements

Packages are required for production license. Trial keys have unlimited access to all features.

Demo showcases functionality using WebViewer UI.

Package: Page ManipulationLive demo

To crop a page in a PDF document.

PDFDoc doc = new PDFDoc(filename);

// Access a PDF page
Page page = doc.GetPage(page_num);

// Crop the page
page.SetCropBox(new Rect(0, 0, 500, 600));
PDFDoc doc(filename);

// Access a PDF page
Page page = doc.GetPage(1);

// Crop the page
page.SetCropBox(Rect(0, 0, 500, 600));
doc := NewPDFDoc(filename)

// Access a PDF page
page := doc.GetPage(1)

// Crop the page
page.SetCropBox(NewRect(0, 0, 500.0, 600.0))

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().

Last updated

Was this helpful?