Description
Inserts a page to the PDF document.
Applies to
Syntax
long InsertPage(PDFPage page, long index)
Argument |
Description |
---|---|
page |
The PDFPage object to add in the document. |
index | The page index in the PDF document at which to insert the page. If you specify an index which is out of the current index scope, the page will be added to the end of the document. |
Return value
Long. Returns 1 if it succeeds, or -1 if an error occurs. For more errors, see the Error Codes.
Usage
Call the function to add a PDFPage object, which is a page, to the specified page index in a PDF document. If you want to add it to the end of the document, you may use the AddPage function.
Note that one PDFPage object can only be added or inserted once in any PDF document. If you want to add or insert the PDFPage object again, clone the object first.
Examples
This example inserts an empty page as the second page in a PDF document.
PDFdocument lpdf_doc PDFpage lpdf_page lpdf_doc = create PDFdocument lpdf_page = create PDFpage //Import a PDF document lpdf_doc.importpdf( "D:\import\noannotsnoPwd.pdf") //Add the page as the 2nd page lpdf_doc.insertpage( lpdf_page, 2) lpdf_doc.save( "D:\save\insertpage.pdf")
See also