setPageOrder

fun setPageOrder(orderedPageRefs: List<PdfReference>)

Replace the document's page order with exactly orderedPageRefs. Rebuilds a single flat /Pages node (kids + /Count), re-parents every page to it, and keeps the catalog pointing at it. This is the engine behind delete, reorder, insert and merge: omit a ref to delete, permute to reorder, append a grafted ref to insert. Pages no longer referenced are dropped by saveRewritten.