Remaps pages for reordering, copying and deletion.

 

   

Syntax
 

[C#]
virtual void RemapPages(string pages)

[Visual Basic]
Overridable Sub RemapPages(pages As String)

 

   

Params
 
Name Description
pages

The list of pages required.

 

   

Notes
 

This method provides a simple method for remapping the pages in a document. It can be used for reordering, copying or deleting pages.

It accepts a list of page numbers and reorders the pages in the document so that they match these page numbers. If a number is repeated more than once the page is duplicated. If a number is omitted the page is deleted.

Page numbers can be delimited using spaces, commas or semicolons. The first page in a document is page one. So to reverse a four page document you might use "4 3 2 1".

If a page is duplicated and it contains Form fields, you may want to call MakeFieldsUnique to avoid sharing fields across pages.

 

   

Example
 

The following code snippet illustrates how one might reverse all the pages in a document.

[C#]
Doc theDoc = new Doc();
theDoc.Read(Server.MapPath("../mypics/sample.pdf"));
theDoc.FontSize = 500;
theDoc.Color.String = "255 0 0";
theDoc.HPos = 0.5;
theDoc.VPos = 0.3;
int theCount = theDoc.PageCount;
string thePages = "";
for (int i = 1; i <= theCount; i++) {
  theDoc.PageNumber = i;
  theDoc.AddText(i.ToString());
  thePages = thePages + (theCount - i + 1).ToString() + " ";
}
theDoc.RemapPages(thePages);
theDoc.Save(Server.MapPath("docremappages.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
theDoc.Read(Server.MapPath("../mypics/sample.pdf"))
theDoc.FontSize = 500
theDoc.Color.String = "255 0 0"
theDoc.HPos = 0.5
theDoc.VPos = 0.3
Dim theCount, i As Integer
Dim thePages As String
theCount = theDoc.PageCount
thePages = ""
For i = 1 To theCount
  theDoc.PageNumber = i
  theDoc.AddText(i.ToString())
  thePages = thePages + (theCount - i + 1).ToString() + " "
Next
theDoc.RemapPages(thePages)
theDoc.Save(Server.MapPath("docremappages.pdf"))
theDoc.Clear()


docremappages.pdf [Page 1]

docremappages.pdf [Page 2]

docremappages.pdf [Page 3]

docremappages.pdf [Page 4]