THotPDF.RegisterNamedDestination

THotPDF

 

概述

在 Catalog 的 /Names /Dests 名称树中注册一个符号目标(ISO 32000-1 §12.3.2.3)。之后 GoTo / GoToR 动作和大纲的 /Dest 条目就可以按名称引用该目标,无需写死页码,页面插入、删除或重新排序时交叉引用也不会失效

 

Delphi 语法:

procedure RegisterNamedDestination(const Name: AnsiString; PageIndex: Integer; FitMode: THPDFDestinationFitMode = dfmFit; Left, Top, Right, Bottom, Zoom: Single = 0);

 

参数

Name 是唯一的 name-tree 键(区分大小写)。PageIndex 从 0 开始,必须指向已经创建的页面(BeginDoc 创建第 0 页;AddPage 追加第 N 页)。

FitMode selects the destination shape per Table 151:

   dfmFit — [page /Fit] (whole page)
   dfmFitH — [page /FitH top] (uses Top)
   dfmFitV — [page /FitV left] (uses Left)
   dfmFitR — [page /FitR llx lly urx ury] — HotPDF reorders parameters as Left, Bottom, Right, Top
   dfmFitB — [page /FitB] (PDF 1.1, fit bounding box)
   dfmFitBH — [page /FitBH top] (PDF 1.1)
   dfmFitBV — [page /FitBV left] (PDF 1.1)
   dfmXYZ — [page /XYZ left top zoom] (zero=inherit)

 

Compliance

没有 PDF/A / PDF/X 限制 – 规范允许在所有一致性配置文件中使用导航辅助功能。最低 PDF 1.2;除非设置了 StrictVersionLock,否则会自动提升文档 Version

 

示例

PDF := THotPDF.Create(nil);
PDF.FileName := 'manual.pdf';
PDF.BeginDoc;
PDF.AddPage;
PDF.AddPage;
PDF.RegisterNamedDestination('Chapter1', 0, dfmFit);
PDF.RegisterNamedDestination('Chapter2', 1, dfmFitH, 0, 500);
PDF.RegisterNamedDestination('FAQTop', 2, dfmXYZ, 100, 200, 0, 0, 1.5);
PDF.EndDoc;

 

可用性

;自 HotPDF v2.119.17 起可用。