THotPDF.InitialZoom Property

 

THotPDF.InitialZoom

THotPDF

 

顶部  上一页  下一页

控制写入文档 OpenAction entry 的初始页面显示缩放。PDF 阅读器打开文件时会遵守该值

 

type

THPDFInitialZoom = (

     FitNone, FitPage, FitWidth, FitHeight, FitBox,

     FitBoxWidth, FitBoxHeight,

     Zoom50, Zoom75, Zoom100, Zoom125, Zoom150, Zoom200);

 

Delphi 语法:

property InitialZoom: THPDFInitialZoom;

 

C++ 语法:

__property THPDFInitialZoom InitialZoom;

 

说明

使用 InitialZoom 设置文档打开时的页面显示模式。HotPDF 会将该值作为 PDF 规范定义的标准 PDF view destinations(Fit、FitH、FitV、FitR、FitB、FitBH、FitBV 或 XYZ)之一写入文档的 /OpenAction entry

自 HotPDF v2.3.11 起,默认值为 FitHeight(PDF /FitV destination),因此生成文档会以每页适配阅读器窗口高度的方式打开。将 InitialZoom 设为 FitNone 可省略 OpenAction entry,并让阅读器回退到自身默认 zoom。若调用 THotPDF.SetOpenNamedDestinationAction,显式命名目标打开动作会优先于 InitialZoom

 

Value              PDF destination    Meaning


FitNone           (none)            No special zoom; let the viewer use its own default.

FitPage           /Fit              Fit the entire page inside the window.

FitWidth          /FitH             Fit page width to the window.

FitHeight         /FitV             Fit page height to the window. (default)

FitBox            /FitR or /FitB     Fit the bounding box of the page contents to the window.

FitBoxWidth      /FitBH          Fit the bounding box width to the window.

FitBoxHeight     /FitBV          Fit the bounding box height to the window.

Zoom50            /XYZ null null 0.5       Open the page at 50% scale.

Zoom75            /XYZ null null 0.75      Open the page at 75% scale.

Zoom100          /XYZ null null 1.0       Open the page at 100% (actual size).

Zoom125          /XYZ null null 1.25      Open the page at 125% scale.

Zoom150          /XYZ null null 1.5       Open the page at 150% scale.

Zoom200          /XYZ null null 2.0       Open the page at 200% scale.

 

关于 InitialZoom 如何与 PDF viewer-preferences dictionary 交互的更高层概览,请参见 ViewerPreferences Complete Reference

 

代码示例

HPDF := THotPDF.Create( nil );
try
  HPDF.FileName  := 'c:\Output.pdf';
  HPDF.InitialZoom := FitWidth;       // Open with page width fitted to window
  HPDF.BeginDoc;
  HPDF.CurrentPage.TextOut( 100, 100, 0, 'Hello World!' );
  HPDF.EndDoc;
finally
  HPDF.Free;
end;