Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

PDFKit.PageBounds

Returns the bounds for the specified PDF display box.

Component Version macOS Windows Linux Server iOS SDK
PDFKit 2.9 ✅ Yes ❌ No ❌ No ✅ Yes, on macOS ✅ Yes
MBS( "PDFKit.PageBounds"; PDF; index { ; box; mm } )   More

Parameters

Parameter Description Example Flags
PDF A container value with the PDF content from a media field. Or a text with an URL. Or a PDF reference from PDFKit.Open.
index The index of the page. From zero to PDFKit.GetPDFPageCount-1. 1
box Optionally, the PDF box to use. Can be Media Box = 0, Crop Box = 1, Bleed Box = 2, TrimBox = 3 or ArtBox = 4. If the box is not defined, we fall back to the media box. Default is 0. 1 Optional
mm Optionally. If you pass 1, we convert the rectangle to millimeters. Else we return points where 72 points are one inch. Default is 0. 0 Optional

Result

Returns four values separated with new line containing x, y, width and height.

Description

Returns the bounds for the specified PDF display box.
Note that only the media box is required for a PDF. If you request the bounds for the crop box, but the PDF does not include a crop box, the bounds for the media box are returned instead. If you request the bounds for other box types, and the PDF does not includes these types, the bounds for the crop box are returned instead.
The coordinates for the box are in page space, so you might need to transform the points if the page has a rotation on it. Also, note that the bounds boundsForBox returns are intersected with the page's media box.

Examples

Get media box of third page in a PDF in a container field:

MBS("PDFKit.PageBounds"; test::data; 2; 0)

Get crop box of sixth page in millimeters in a PDF with reference:

MBS("PDFKit.PageBounds"; $ref; 5; 1; 1)

See also

This function checks for a license.

Created 18th August 2014, last changed 16th February 2015


PDFKit.OpenURL - PDFKit.Print