Easily reorder the pages of your PDF document.
In the PDF specification, the visual sequence of pages is not determined by the order of the bytes on disk. It is determined purely by an array structure.
The root of the document contains a Pages Dictionary. Inside this dictionary is the /Kids array, which holds reference pointers to every single page object.
When you drag a page to a new position in this UI, we do not rewrite the heavy graphics data or images associated with that page.
We simply update the order of the ID numbers in the /Kids array. For example, changing [1 2 3] to [3 1 2]. When the file is saved, the PDF viewer reads this new array and displays the pages in the new sequence. This makes reordering extremely fast and memory-efficient.
Because manipulating the array requires only editing the document's cross-reference table and dictionary objects, we can perform this operation entirely in your browser using WebAssembly.
We use zero-copy ArrayBuffer transfers between the UI thread and the background Web Worker, ensuring that even reordering a massive 1,000-page book takes only milliseconds without freezing the browser.
What actually happens to the PDF data when you reorder pages?