Adds a page to the current document.

 

   

Syntax
 

PageID = Doc.AddPage([PageNum])

 

   

Params
 
Name Type Description
PageNum Long

The page insertion location (optional).

By default, pages are added at the end of the document.

PageID Long The Object ID of the newly added Page object.

 

   

Notes
 

Adds a page to the current document.

The AddPage method returns the Object ID of the newly added Page object. Typically, you will want to assign this return value to the document Page property using code of the form.

theDoc.Page = theDoc.AddPage()

Pages are added at the end of the document. However, you can use the PageNum parameter to insert pages at other locations. The following code inserts a page at the start of a document.

theDoc.Page = theDoc.AddPage(1)

Any existing page and all subsequent pages will be shifted towards the end of the document to make room for the insertion.

 

   

Example
 

The following code adds three pages to a document. Each page is marked with the page number and page Object ID.

Set theDoc = Server.CreateObject("ABCpdf10.Doc")
theDoc.FontSize = 96 ' big text
theDoc.HPos = 0.5 ' centered
theDoc.VPos = 0.5 ' ...
For i = 1 To 3
  theDoc.Page = theDoc.AddPage()
  txt = "Page " & i & ", ID="
  txt = txt & theDoc.Page
  theDoc.AddText txt
Next
theDoc.Save "c:\mypdfs\docaddpage.pdf"


docaddpage.pdf