PDFium Component Docs

PrintPageRanges プロパティ

この API エントリでは識別子、シグネチャ、コードブロック、PDF 用語を元の表記のまま保持します。
コンポーネント: TPdf  ·  ユニット: PDFium
PDF の作成者が印刷ダイアログに提案したい 1-based ページ範囲のデコード済みリストです —/PrintPageRange entry of the document's /ViewerPreferences dictionary.

構文

property PrintPageRanges: TPdfPrintPageRanges; // read only

説明

PDF 1.7 added /PrintPageRange to /ViewerPreferencesは、ビューアーが印刷ダイアログで事前選択すべきページ範囲を表す整数ペアの列です (PDF 32000-1 § 12.2 Table 150)。PDFium はその配列を解析し、このプロパティを通じて Pascal 動的配列のTPdfPrintPageRange records, each holding a StartPage and EndPage in one-based numbering.

文書にこのエントリが含まれていない場合、返される配列は空です (Length(Result) = 0) — これは「すべてのページを印刷」として扱います。単一ページが推奨される場合、対応する範囲ではStartPage and EndPage values, e.g. (3, 3) for "page 3 only".

Pair the result with PrintCopies, PrintScaling and PrintPaperHandling印刷ダイアログを接続するときに併用すると、4 つのヒントすべてをユーザーに表示できます。他の印刷設定と同じくこれは助言のみであり、PDFium はレンダリング時に範囲を強制しません

備考

// Build a comma-separated string like "1-3, 7, 10-12".
var Ranges: TPdfPrintPageRanges;
var S: string;
var I: Integer;
begin
  Ranges := Pdf1.PrintPageRanges;
  if Length(Ranges) = 0 then Exit;
  for I := 0 to High(Ranges) do
  begin
    if S <> '' then S := S + ', ';
    if Ranges[I].StartPage = Ranges[I].EndPage then
      S := S + IntToStr(Ranges[I].StartPage)
    else
      S := S + Format('%d-%d', [Ranges[I].StartPage, Ranges[I].EndPage]);
  end;
  editRanges.Text := S;
end;

関連項目

PrintCopies, PrintScaling, PrintPaperHandling, ViewerPreference