THotPDF.CopyPageFromDocument Method

 

THotPDF.CopyPageFromDocument

THotPDF

 

Top  Previous  Next

Copies page from source document  to the current document.

 

Delphi syntax:

procedure CopyPageFromDocument (  SourceDoc: THotPDF;  SourceIndex: Integer;  DestIndex: Integer  );

 

C++ syntax:

void __fastcall CopyPageFromDocument ( THotPDF * SourceDoc, int SourceIndex, int DestIndex );

 

Description

Call CopyPageFromDocument to copy page with number SourceIndex from SourceDoc document to current document page with number DestIndex.

The copied page keeps its page resources and content stream, including embedded CID TrueType fonts, so the method can be used repeatedly when merging pages from several source documents.

 

 

Code Example

// Copy page from existing PDF to new PDF
var
  SourcePDF: THotPDF;

begin
  SourcePDF := THotPDF.Create( nil );
  try
    SourcePDF.LoadFromFile( 'c:\Source.pdf' );

    HPDF.BeginDoc;
    HPDF.CopyPageFromDocument( SourcePDF, 1 );   // Copy page 1 from source document
    HPDF.EndDoc;
  finally
    SourcePDF.Free;
  end;
end;