bounds(for:)
Returns the bounds for the specified PDF display box.
Declaration
func bounds(for box: PDFDisplayBox) -> CGRectfunc bounds(for box: PDFDisplayBox) -> NSRectDiscussion
The PDFDisplayBox enumeration defines the various box types.
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.
boundsForBox throws a range exception if box is not in range.