PDF Xpress for ActiveX - User Guide > How To > Modify PDF Document Content > Add, Insert & Delete Pages |
The CreatePage method is called to add a new, empty page to a specified location in a PDF document.
PDF Xpress™ enforces the maximum allowable page size to 14,400 by 14,400 units (200 by 200 inches). PDF Xpress™ performs no special action in cases where an attempt is made to exceed this allowable page size. |
VB Example |
Copy Code
|
---|---|
'This code demonstrates creating a new page On Error GoTo error Dim pdfXpress1 As New PdfXpress pdfXpress1.Initialize pdfxpress1.RaiseExceptions = True Dim document As New PdfDocument document.SetParentControl pdfXpress1 Dim openOpts As New OpenOptions openOpts.FileName = "C:\pdfsample.pdf" document.OpenDocumentOptions openOpts Dim opts As New PageOptions opts.MediaHeight = 792 opts.MediaWidth = 612 document.CreatePage 5, opts . . . GoTo finish error: MsgBox Err.Description finish: Set document = Nothing pdfxpress1.Terminate Set pdfxpress1= Nothing |
Call the InsertPages method to insert one or more pages at a specified location in the PDF document.
VB Example |
Copy Code
|
---|---|
'This code demonstrates inserting a new page On Error GoTo error Dim pdfXpress1 As New PdfXpress pdfXpress1.Initialize pdfxpress1.RaiseExceptions = True Dim document As New PdfDocument Dim sourcedoc As New PdfDocument document.SetParentControl pdfXpress1 sourcedoc. SetParentControl pdfXpress1 document.OpenDocument "C:\pdfsample.pdf", "" sourcedoc.OpenDocument "C:\test.pdf", "" Dim insertOpts As New InsertPagesOptions Dim docpageList As New PageList Dim docpageRange As New PageRange docpageList.Add docpageRange docpageRange.StartPageNumber = 0 docpageRange.pageCount = 2 insertOpts.SourceDocument = sourcedoc insertOpts.PageList = docpageList document.InsertPages insertOpts . . . GoTo finish error: MsgBox Err.Description finish: Set document = Nothing pdfxpress1.Terminate Set pdfxpress1= Nothing |
Call the DeletePage method to delete a specified page from the PDF document.
VB Example |
Copy Code
|
---|---|
'This code demonstrates deleting a page On Error GoTo error Dim pdfXpress1 As New PdfXpress pdfXpress1.Initialize pdfxpress1.RaiseExceptions = True Dim document As New PdfDocument document. SetParentControl pdfXpress1 document.OpenDocument "C:\pdfsample.pdf", "" document.DeletePage 2 . . . GoTo finish error: MsgBox Err.Description finish: Set document = Nothing pdfxpress1.Terminate Set pdfxpress1= Nothing |