Some test text!

Reorder pageskeyboard_arrow_down

Reordering PDF pages using JavaScript

Pages in the PDF document can be reordered using the movePages function.

  .then(instance => {
    const { docViewer } = instance;

    docViewer.on('documentLoaded', async () => {
      const doc = docViewer.getDocument();
      const page1 = 1, page2 = 2, page3 = 3;

      const pagesToMove = [page2, page3];
      const insertBefore = page1;

      await doc.movePages(pagesToMove, insertBefore);
      // pages are now in the order of [page2, page3, page1];

Get the answers you need: Support


Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.