PDFium Delphi Component Docs

LinkOptions 屬性

元件: TPdfView  ·  單元: PDFium
Published 集合,用來控制當使用者點擊連結時,檢視器會自動跟隨 PDFium 四種連結動作中的哪些類型

語法

property LinkOptions: TPdfViewLinkOptions;

說明

LinkOptions 是一個 Pascal set of TPdfViewLinkOption。每個旗標會切換一種 PDF 連結動作類型的自動處理:

預設值為 [loAutoGoto, loAutoOpenURI] — 安全的頁面跳轉與 URL 開啟維持自動,而程式啟動與跨文件跳轉則需要應用程式明確選擇加入

每個連結動作在自動處理器執行「之前」,也會先引發對應的 OnAnnotationLinkClick(帶 /Link 註解的連結)或 OnWebLinkClick(網頁連結掃描命中)事件。將事件的 Handled 參數標記為 True 可抑制自動動作,或透過確認提示 / 安全性原則 / 稽核記錄來重新導向連結

備註

範例

// Safe defaults: auto-follow only in-doc jumps and URIs
PdfView1.LinkOptions := [loAutoGoto, loAutoOpenURI];

// Vet URI clicks before opening
procedure TForm1.PdfView1WebLinkClick(Sender: TObject;
  WebLinkIndex: Integer; const Url: WString;
  var Handled: Boolean);
begin
  if MessageDlg('Open ' + Url + '?',
    mtConfirmation, [mbYes, mbNo], 0) <> mrYes then
    Handled := True; // suppress auto-handling
end;

另請參閱

OnAnnotationLinkClick, OnWebLinkClick, WebLinkAtPos, LinkAnnotationAtPos