usePageCount
Returns the number of pages and re-renders the component only when it changes. Prefer it over usePages when only the count matters: it doesn't re-render on page rearrangement, resizing, or rotation.
const pageCount = usePageCount()Returns 0 while no document is loaded.
Example
import { usePageCount } from '@sdk-pdf/react'
function PageCountBadge() {
const pageCount = usePageCount()
return <span>{pageCount} pages</span>
}