How can I rearrange the pages in a PDF without changing the assigned paged numbers? These correspond to the original document folio numbers.
In theory it would be possible to 'record and play back' the page numbers using a folder-level script, but it's far from trivial. You would have to use the doc.movePage() function - presumably driven by a dialog box - to do the page shuffling so there was a way to track what was being done, then swap the page 'labels' of the two affected pages. That's where it gets messy.
We have functions in the JSAPI which can read and write the page label, but they don't do things in a logical way. The 'getPageLabel()' function simply returns a string, but the 'setPageLabel()' method expects to be told the numbering scheme, prefix, etc. You'd have to parse the string and work out what scheme it was implementing.
Plus, when you use the setPageLabels (not *setPageLabel, by the way) method it automatically applies the scheme you've selected to all the proceeding pages as well, until it encounters a new attached label, which makes it very annoying to work with... In short, this is probably much more trouble than it's worth.