modern-pdf-lib / cropPage
Function: cropPage()
cropPage(
doc,index,cropBox):void
Defined in: src/core/pageManipulation.ts:280
Set a crop box on a page.
The crop box defines the visible region of the page when displayed or printed. It defaults to the media box if not set.
Parameters
doc
The PdfDocument to modify.
index
number
Zero-based index of the page.
cropBox
The crop box rectangle.
Returns
void
Throws
RangeError if the index is out of bounds.
Example
ts
cropPage(doc, 0, { x: 50, y: 50, width: 495, height: 742 });