Menu

Reorder PDF Pages in C#: Custom Page Order and Full Document Reversal
📰

Reorder PDF Pages in C#: Custom Page Order and Full Document Reversal

DEV Community: dotnet·Jack9012·6 days ago
#LlDA02Hl
#devtodotnet#devto#dev#pages#document
Reading 0:00
15s threshold

After merging scanned files, you may find that the pages are in the wrong order, or you may want to move pages from the end of a document to the beginning. You can reorder PDF pages by specifying page indices, without first converting the PDF into images.

This article uses Spire.PDF for .NET to demonstrate two approaches: arranging pages in a custom order and reversing the page order of an entire document. Both examples use the same method, PdfPageCollection.ReArrange(int[] orderArray) . The difference lies in how the ordering array is generated.

1. Install Spire.PDF for .NET

Spire.PDF for .NET is a library for reading, creating, and processing PDF files in .NET applications. This article uses its document loading, page reordering, and file saving APIs.

Run the following command in the NuGet Package Manager Console in Visual Studio:

Install - Package Spire .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.