pageCount

open override val pageCount: Int(source)

Number of pages. Before pages materializes this reads the root /Pages /Count, so a 10,000-page document answers a UI badge without constructing 10,000 page objects. Once pages exists its size is authoritative.

A damaged file can declare a count its page tree does not hold. A missing or negative /Count, or one larger than the number of objects in the file, falls through to the tree walk. Any other declared count is trusted until pages exists, so use pageCountIn for the exact count.