IPages methods reference

Count()

Returns the number of items in the Pages collection, in other words the number of pages in the PDF.

Syntax

LONG Count ( )

Return value

The number of pages in the PDF.

Delete()

Deletes a page from the PDF.

Syntax

VOID Delete ( LONG index )

index

0-based index of the page to delete.

ExtractTo(destFilename, srcIndex, srcCount, optimize)

Extracts pages from the PDF and creates a new file with these pages. All relevant resources are copied with the pages. If the target file already exists, it is overwritten.

Syntax

VOID ExtractTo (
STRING destFilename,
LONG srcIndex,
LONG srcCount,
BOOL optimize
)

destFilename

Name of the PDF to create with the specified pages.

srcIndex

0-based index of the first page to copy.

srcCount

Number of contiguous pages starting from srcIndex to extract.

optimize

If true, optimize (linearize and garbage-collect) the output file.

Insert(index, *mediaSize)

Inserts a new blank page in the PDF file. See also: Count().

Syntax

VOID Insert (
LONG index,
IPdfRect * mediaSize
)

index

0-based index at which to insert the page. The page is inserted *before* the page at index "index ". To insert a page at the end, use IPages.Count().

mediaSize

IPdfRect structure containing the rectangular dimensions of the new page, in points. Cannot be NULL.

InsertFrom(srcFilename, srcIndex, srcCount, destIndex)

Inserts pages from another PDF file into this one. All relevant resources are copied with the pages. See also: Count().

Syntax

VOID InsertFrom (
STRING srcFilename,
LONG srcIndex,
LONG srcCount,
LONG destIndex
)

srcFilename

Name of the PDF from which pages are retrieved.

srcIndex

0-based index of the first page to copy.

srcCount

Number of contiguous pages starting from srcIndex to insert. If srcCount is -1, all pages from srcIndex up to the end are inserted.

destIndex

0-based index of the position where to insert the pages. They will be inserted before the page at index destIndex. To insert the pages at the end, use IPages.Count().

InsertFrom2(srcPages, srcIndex, srcCount, destIndex)

Inserts pages from another IPages object into this one. All relevant resources are copied with the pages. See also: Count().

Syntax

VOID InsertFrom2 (
IPages srcPages,
LONG srcIndex,
LONG srcCount,
LONG destIndex
)

srcPages

IPages collection from which the pages are retrieved.

srcIndex

0-based index of the first page to copy.

srcCount

Number of contiguous pages starting from srcIndex to insert. If srcCount is -1, all pages from srcIndex up to the end are inserted.

destIndex

0-based index of the position where to insert the pages. They will be inserted before the page at index destIndex. To insert the pages at the end, use IPages.Count().

Item(index)

Returns a Page object from the PDF. Note that since Item() is the collection's default method, it can be omitted altogether (e.g. IPages(0) is the same as IPages.Item(0)).

Syntax

IPage Item ( LONG index )

index

0-based index of the page to acquire.

Return value

An IPage object for the specified page. (See Page object.)

Move(index, count, offset)

Moves a range of pages within the same PDF.

Syntax

VOID Move (
LONG index,
LONG count,
LONG offset
)

index

0-based index of the first page of the range.

count

Number of contiguous pages to move.

offset

Number of hops to move the pages. If negative, the pages are moved towards the beginning of the file. If positive, towards the end.