Some test text!

Loading...
Guides
Reorder pages

Reordering PDF pages using JavaScript

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

// config.js
const { documentViewer } = instance.Core;

documentViewer.addEventListener('documentLoaded', async () => {
  const doc = documentViewer.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

Upcoming Webinar: PDFTron SDK Tech Review | Nov 29, 2022 at 2 pm ET

PDFTron SDK

The Platform

NEW

© 2022 PDFTron Systems Inc. All rights reserved.

Privacy

Terms of Use