Class PageAttributes


  • public final class PageAttributes
    extends java.lang.Object
    Walks a page dictionary's /Parent chain for an "inheritable" page attribute -- /MediaBox, /CropBox, /Resources (ISO 32000-1 7.7.3.4, Table 30) -- that the page itself doesn't declare. PageTree only navigates /Kids downward (find/count pages); nothing existing walked /Parent upward for this, so this fills that gap.

    Each attribute is looked up independently: a page can perfectly validly inherit /MediaBox from one ancestor level while declaring its own /CropBox, or vice versa -- callers must not assume "found MediaBox at level N" implies anything about where CropBox/Resources come from.

    • Method Detail

      • getInherited

        public static COSBase getInherited​(COSDictionary page,
                                           java.lang.String key)
        Returns:
        the first non-null value of key found starting at page itself and walking up through /Parent, or null if neither the page nor any ancestor up to the /Pages root declares it.
      • getInheritedArray

        public static COSArray getInheritedArray​(COSDictionary page,
                                                 java.lang.String key)
        Convenience for array-valued attributes (/MediaBox, /CropBox).
      • getInheritedResources

        public static COSDictionary getInheritedResources​(COSDictionary page)
        Convenience for /Resources specifically (dictionary-valued).