THotPDF.CopyPageFromDocument Method

 

呼叫 CopyPageFromDocument,可將 SourceDoc document 中編號為 SourceIndex 的頁面複製到目前檔案中編號為 DestIndex 的頁面

THotPDF

 

傳回頂部  上一頁  下一頁

Copies page from source document  to the current document.

 

Delphi 語法:

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

 

C++ 語法:

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

 

說明

呼叫 CopyPageFromDocument,將 SourceDoc document 中 number 為 SourceIndex 的 page 複製到目前 document 中 number 為 DestIndex 的 page

複製的頁面會保留其 page resources 與 content stream,包括 embedded CID TrueType fonts,因此此方法可在合併多個來源檔案的頁面時重複使用

從 page dictionaries、resource dictionaries、arrays 與 object streams 複製的 PDF name values,會先從 ISO 32000-1 #XX escape form 解碼,再由 HotPDF 重新寫入。這可避免來源名稱如 /PANTONE#20216#20CVC 或 /application#2Fxml 被輸出為 double-escaped number sign

 

 

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;