|
これらの methods は、pages の insert、extract、reorder を行う loaded-document workflow を提供します
Delphi syntax:
function HPDFParsePageRange(const PageRange: string; PageCount: Integer): THPDFPageIndexArray;
procedure AppendPagesFromDocument(SourceDoc: THotPDF; const PageRange: string);
procedure InsertPagesFromDocument(SourceDoc: THotPDF; const PageRange: string; InsertAfterPage: Integer);
procedure InsertPagesFromDocument(SourceDoc: THotPDF; const LogicalPageIndices: array of Integer; InsertAfterPage: Integer);
procedure CopyPageByPhysicalIndex(SourceDoc: THotPDF; SourceIndex: Integer; DestIndex: Integer);
procedure ExtractPagesToFile(const OutputFile: TFileName; const PageRange: string);
procedure ExtractPagesToFile(const OutputFile: TFileName; const LogicalPageIndices: array of Integer);
procedure MovePage(PageIndex: Integer; NewPageIndex: Integer);
procedure SaveLoadedDocument(const TargetFile: TFileName);
property OnPageOperationProgress: THPDFPageOperationProgressEvent;
説明
HPDFParsePageRange は 1,3-4,6- のような 1-based range strings を 0-based page indices に変換します。empty input はすべての pages を選択します。invalid page numbers、descending ranges、malformed tokens は exception を発生させます
InsertPagesFromDocument は別の loaded THotPDF instance から current document に pages を copy します。既存の zero-based array calls は引き続き support され、string overload は one-based page ranges を受け付けます。InsertAfterPage は zero-based です。先頭に insert するには -1 を渡します
AppendPagesFromDocument は、同じ one-based page-range syntax を使って、選択した source pages を current document の末尾へ append します
CopyPageByPhysicalIndex は 0-based の物理ページインデックスで指定したソースページを 0-based の宛先位置へコピーします
ExtractPagesToFile は current document から選択した pages を新しい PDF file に書き込みます。既存の zero-based array calls は引き続き support され、string overload は one-based page ranges を受け付けます
OnPageOperationProgress は append、insert、extract、および将来の merge-style page operations について page-level progress を報告します
MovePage は 1 つの zero-based page を別の zero-based position へ移動して current document を reorder します。この method は loaded page array と root page tree を更新するため、後続の save と extraction calls は新しい順序を使用します
SaveLoadedDocument はページ編集、フォーム編集、コピー操作後の読み込み済みオブジェクトグラフを新しいファイルへ書き込みます
Code Example
BasePDF.LoadFromFile('base.pdf');
InsertPDF.LoadFromFile('insert.pdf');
BasePDF.InsertPagesFromDocument(InsertPDF, '1-2', 0);
BasePDF.AppendPagesFromDocument(InsertPDF, '2');
BasePDF.MovePage(BasePDF.PagesCount - 1, 1);
BasePDF.ExtractPagesToFile('selected-pages.pdf', '2,4');
BasePDF.SaveLoadedDocument('reordered.pdf');
|