Class PageTree


  • public final class PageTree
    extends java.lang.Object
    Walks a parsed document's page tree (/Root/Pages/Kids/...), resolving indirect references at every step. General-purpose COS navigation -- useful to any feature that needs "page N", not just digital signatures (annotations, form-filling, page-level metadata, ...).
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int countPages​(COSDictionary catalog)
      Total number of leaf pages under catalog's /Pages tree.
      static COSDictionary findPage​(COSDictionary catalog, int index)
      Returns the zero-based index-th page dictionary under catalog's /Pages tree, or null if the catalog has no (usable) page tree or index is out of range.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • findPage

        public static COSDictionary findPage​(COSDictionary catalog,
                                             int index)
        Returns the zero-based index-th page dictionary under catalog's /Pages tree, or null if the catalog has no (usable) page tree or index is out of range.
      • countPages

        public static int countPages​(COSDictionary catalog)
        Total number of leaf pages under catalog's /Pages tree. Trusts the root /Pages node's /Count entry (required by the spec to reflect the total leaf-page count), falling back to a full tree walk only if that entry is missing -- a malformed but real-world document.