property Destination[Index: Integer]: TDestination; // read only
命名目的地是儲存在 PDF 文件目錄中的符號名稱(例如 "chap5.fig3"),會解析成具體的頁面-位置-縮放三元組。它們讓大綱、連結註解與外部文件能以穩定名稱引用目標,而非寫死的頁面座標,因此文件可以重新編頁而不會破壞連入連結
PDFium Delphi Component 將舊式 /Dests 字典與新式 /Names /Dests 名稱樹扁平化為單一以 0 起算的清單。Destination[Index] 傳回 TDestination 記錄,攜帶目的地名稱、以 1 起算的目標頁碼、解碼後的 ViewMode、原始 ViewParameters、檢視座標、縮放係數與存在旗標
使用 DestinationCount 取得命名目的地的總數,以 Destination[I] 迭代,並在已知目標名稱時使用 DestinationByName
| Index | Integer 型別,扁平化命名目的地清單中以 0 起算的位置,必須落在 [0, DestinationCount - 1] 範圍內。索引超出範圍時,會傳回填滿零的記錄,且 Handle = nil |
HasX、HasY 與 HasZoom 區分「適合頁面」/「適合寬度」目的地(這些成分不存在)與明確的 XYZ 目的地。只套用標記為存在的成分ViewMode 區分 XYZ、Fit、FitH、FitV、FitR、FitB、FitBH 與 FitBV 目的地,呼叫端無需解碼 PDFium 常數ViewParameterCount 給出固定四元素 ViewParameters 陣列中的有效項目數Handle
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;