Cropping PDF pages on iOS
To crop a page in a PDF document.
PTPDFDoc *doc = [[PTPDFDoc alloc] initWithFilepath: filename];
// Access a PDF page
PTPage *page = [doc GetPage:1];
// Crop the page
[page SetCropBox: [[PTPDFRect alloc] initWithX1:0 y1:0 x2:500 y2:600]];let doc: PTPDFDoc = PTPDFDoc(filepath: filename)
// Access a PDF page
let page: PTPage = doc.getPage(1)
// Crop the page
page.setCropBox(PTPDFRect(x1: 0, y1: 0, x2: 500, y2: 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().
Last updated
Was this helpful?