VB.NET PDF: How to HTML5 PDF Viewer PDF Create PDF Export File & Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print WPF PDF Viewer Work with Other SDKs Barcode Read Barcode Create OCR Twain
Page: Move Page Position
Home ›› XDoc.PDF ›› VB.NET PDF: Move PDF Page

VB.NET PDF - How to Sort PDF Doc Pages in VB.NET

VB.NET Guide for Sorting PDF Document Pages Using VB.NET Demo Code

Look for HTML5 PDF Editor?

EdgePDF: ASP.NET PDF Editor is the best HTML5 PDF Editor and ASP.NET PDF Viewer based on XDoc.PDF, JQuery, HTML5. It supports ASP.NET MVC and WebForms projects.

Best Visual Studio .NET PDF file edit SDK control for sorting PDF page order in VB.NET

A .NET PDF page reorganizing control, built on .NET framework 2.0

Able to adjust and several or all PDF document page order in Visual Basic .NET class

Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint

Support to reverse page order in adobe PDF document in both .NET WinForms application and ASP.NET webpage

Enable move, sort and reorder PDF page in preview

Free component and library for quick evaluation in VB.NET class

Provide online Visual Basic .NET source code

If you are a specialist who often works with PDF documents and specifications, you may unwilling to waste your time on finding needed information in a PDF file. So a PDF document pages sorting control is needed to arrange PDF document file pages in certain order as you do with other documents in your office. As a result, you will save much time and improve working efficiency.

RasterEdge VB.NET PDF Doc reorganizing control is often used to change order of PDF document pages using VB code in multiple .NET applications with ease. This PDF Document reordering library for VB.NET can be used in Visual Studio 2005 or later versions. It is entirely compatible with various operating systems, such as Windows XP, Windows Vista, Windows Server 2000 and so on. Using this PDF Document reorganizing SDK, you are able to reorder the whole PDF document pages or just adjust position of certain PDF document page. No matter which demand you have, it can be finished quickly and accurately.

In the following part, we will tell you how to use our VB.NET PDF document pages reordering control to move PDF page, swap two pages position and sort the PDF pages through VB demo code in easy ways. If you want to use this PDF document reordering library to sort your PDF file pages, just refer to following PDF document pages sorting tutorial directly.

DLLs for Sorting PDF Doc Pages in VB.NET

Users are free to download the evaluation version of our VB.NET PDF document reorganizing library to add PDF file pages sorting features in VB.NET applications. To use the PDF document reorganizing function, users may need the following dlls in the downloaded and unzipped evaluation package and locate them to VB.NET project references.

Add necessary references:









Use corresponding namespaces;

  using RasterEdge.Imaging.Basic;

  using RasterEdge.XDoc.PDF;

Move Page to Specified Position in VB.NET

Code below explains how to move a PDF page to a new position in VB.NET program.

Dim inputFilePath As String = Program.RootPath + "\\" + "1.pdf"
Dim outputFilePath As String = Program.RootPath + "\\" + "Output.pdf"

' load the PDF file
Dim doc As PDFDocument = New PDFDocument(inputFilePath)

' move the 2nd page in the file
Dim moveFrom As Integer = 1
' to the 6th position in the file
Dim moveTo As Integer = 5
' move the page 
doc.MovePage(moveFrom, moveTo)

' output the document

Swap Two PDF Pages Position in VB.NET

You may choose two pages of PDF file and exchange their position with this VB.NET code.

Dim filepath As String = ""
Dim outPutFilePath As String = ""
Dim doc As PDFDocument = New PDFDocument(filepath)

' Swap page 0 and page 1.
doc.SwapTwoPages(0, 1)

' Save PDF document.

Sort Multiple PDF Pages with a Certain Order in VB.NET

Use VB.NET sample code below to sort several pages of PDF file to your desired order.

' get PDFDocument object from a source file
Dim inputFilePath As String = Program.RootPath + "\\" + "1.pdf"
Dim doc As PDFDocument = New PDFDocument(inputFilePath)

' show page count of the document
Dim pageCount As Integer = doc.GetPageCount()
Console.WriteLine("Page Count: " + pageCount)

' define the new order for all pages
' 1. the length of the array MUST BE equal to pageCount
' 2. each page index SHOULD be in the array and only once
' otherwise, the method would throw exception
Dim pageOrders = New Integer() {1, 3, 0, 5, 4, 6, 2}

' save the PDFDocument
Dim outputFilePath As String = Program.RootPath + "\\" + "Output.pdf"