Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/

Organize PDF pages

Reorder pages in a PDF

Create a new PDF with every source page exactly once in a supplied one-based sequence, and keep the selected source file unchanged.

Reorder summary
Input
PDF and page sequence
Output
Reordered PDF
Runs on
Browser-local WebAssembly or .NET
Microsoft Office
Not required
License
MIT

The one-based sequence must include every source page exactly once; subsets, omissions, and duplicates are rejected.

Browse all PDF workflows

Practical steps

Create a PDF with a new page order

Describe one complete permutation of the source pages and write the resolved order into a separate document.

  1. SelectChoose one PDF and review the current page order.
  2. SequenceEnter every source page exactly once in the desired order, such as 3,1,2,4-last.
  3. CreateGenerate the reordered PDF and download its operation report.

Reordering writes pages in the sequence supplied by the caller. That sequence must be a full permutation: every source page appears exactly once, with no omissions or duplicates. It is useful for corrected scan order, assembled packets, covers placed after generation, and workflows that need a deterministic page tree before signing.

Reorder from .NET

using OfficeIMO.Pdf;

PdfDocument source = PdfDocument.Load("scan.pdf");
PdfPageSelector order = PdfPageSelector.Parse("3,1,2,4-last");
PdfDocument reordered = source.Pages.Reorder(order);

File.WriteAllBytes("scan.reordered.pdf", reordered.ToBytes());

The operation creates a new document and preserves the page count. Use extract pages or delete pages when the output should contain only a subset.

Separate order from rotation

Reordering changes where pages appear; it does not change their orientation. Apply rotate pages separately so each operation and report says exactly what changed.

Example source

Download source