pageBox static method
The type box of page, with the box inheritance rules applied.
A missing box falls back to the /CropBox and then to the /MediaBox;
the /CropBox is intersected with the /MediaBox, as the specification
requires. A box written as an indirect reference is ignored: resolving it
requires the object store from phase F1.
Implementation
static PdfBox pageBox(PdfPage page, [PdfBoxType type = PdfBoxType.media]) {
final media = _mediaBox(page);
if (type == PdfBoxType.media) return media;
final crop = _clipToMedia(_declaredBox(page, PdfBoxType.crop), media);
if (type == PdfBoxType.crop) return crop;
final specific = _clipToMedia(_declaredBox(page, type), media);
return specific == media ? crop : specific;
}