ImageEn, unit iexUserInteractions

TIEPdfViewerInteraction.ImportPages

TIEPdfViewerInteraction.ImportPages


Declaration

function ImportPages(const Filename: String; const Pages: array of Integer; InsertIndex: Integer = -1; const Password: AnsiString = ''): Boolean; overload;
function ImportPages(const Filename: String; const ImportRange: string = ''; InsertIndex: Integer = -1; const Password: AnsiString = ''): Boolean; overload;
function ImportPages(const Stream: TStream; const Pages: array of Integer; InsertIndex: Integer = -1; const Password: AnsiString = ''): Boolean; overload;
function ImportPages(const Stream: TStream; const ImportRange: string = ''; InsertIndex: Integer = -1; const Password: AnsiString = ''): Boolean; overload;
function ImportPages(Document: TPdfDocument; const Pages: array of Integer; InsertIndex: Integer = -1): Boolean; overload;
function ImportPages(Document: TPdfDocument; const ImportRange: string = ''; InsertIndex: Integer = -1): Boolean; overload;


Description

Import pages from another PDF file or PdfViewer.
Specify a filename (and optionally password) or a TIEPdfViewerInteraction.Document.

The pages to import are specified by ImportRange or the Pages array. If a null value is specified, ALL pages are imported.
ImportRange is a string, e.g. "1,3,5-7". IT IS ONE-BASED.
Pages is an array of page indexes, e.g. [0, 2, 4, 5, 6]. IT IS ZERO-BASED.
The following will have the same effect:
ImageEnView1.PdfViewer.ImportPages( 'C:\Document.pdf', '1,3,5-7' );
ImageEnView1.PdfViewer.ImportPages( 'C:\Document.pdf', [0, 2, 4, 5, 6] );


InsertIndex specifies the insertion position, e.g. specifying 1 will make the imported document the second page (becomes index 1). If -1 is specified, the pages are added to the end of the document.

Result will be true if the import succeeds.

Note: DocModified will be true after importing


Demo

Demo  Demos\Other\PdfViewer\PdfViewer.dpr


Examples

// Copy all pages from a PDF File (to the end of this document)
ImageEnView1.PdfViewer.ImportPages( 'C:\Document.pdf' );

// Import the first page from a PDF File and make it the first page of this document
ImageEnView1.PdfViewer.ImportPages( 'C:\Document.pdf', [0], 0 );

// Which is the same as
ImageEnView1.PdfViewer.ImportPages( 'C:\Document.pdf', '1', 0 );

// Copy all pages from another TImageEnView
ImageEnView1.PdfViewer.ImportPages( ImageEnView1.PdfViewer.Document );


See Also

- ImportPagesIntoPDF
- DeletePages
- MovePages