PDFium Delphi Component 文件

Destination 屬性

元件: TPdf  ·  單元: PDFium
傳回命名目的地,包含其目標頁面、PDF 檢視模式、原始檢視參數、座標與縮放旗標

Syntax

property Destination[Index: Integer]: TDestination; // read only

Description

命名目的地是儲存在 PDF 文件目錄中的符號名稱(例如 "chap5.fig3"),會解析成具體的頁面-位置-縮放三元組。它們讓大綱、連結註解與外部文件能以穩定名稱引用目標,而非寫死的頁面座標,因此文件可以重新編頁而不會破壞連入連結

PDFium Delphi Component 將舊式 /Dests 字典與新式 /Names /Dests 名稱樹扁平化為單一以 0 起算的清單。Destination[Index] 傳回 TDestination 記錄,攜帶目的地名稱、以 1 起算的目標頁碼、解碼後的 ViewMode、原始 ViewParameters、檢視座標、縮放係數與存在旗標

使用 DestinationCount 取得命名目的地的總數,以 Destination[I] 迭代,並在已知目標名稱時使用 DestinationByName

Parameters

IndexInteger 型別,扁平化命名目的地清單中以 0 起算的位置,必須落在 [0, DestinationCount - 1] 範圍內。索引超出範圍時,會傳回填滿零的記錄,且 Handle = nil

Remarks

Example

var
  I: Integer;
  Dest: TDestination;
begin
  Pdf1.LoadFromFile('manual.pdf');
  Memo1.Lines.Add(Format('%d named destinations:', [Pdf1.DestinationCount]));
  for I := 0 to Pdf1.DestinationCount - 1 do
  begin
    Dest := Pdf1.Destination[I];
    Memo1.Lines.Add(Format('%s -> page %d (X=%.1f Y=%.1f Zoom=%.2f)',
      [Dest.Name, Dest.PageNumber, Dest.X, Dest.Y, Dest.Zoom]));
  end;
  // Navigate to the first destination
  if Pdf1.DestinationCount > 0 then
    Pdf1.PageNumber := Pdf1.Destination[0].PageNumber;
end;

See Also

DestinationCount, DestinationByName, PageNumber, Bookmark, LinkAnnotation