RenderDocumentToFile

渲染和打印

描述

将所选文档的指定页面渲染为磁盘上的图像文件

默认情况下,渲染使用 Windows XP 及更高版本默认可用的 GDI+ 系统,选项 10(TIFF(G4)输出)仅在 Windows Vista、Windows Server 2008 及更高版本中可用

也可以使用 Cairo 进行渲染,请使用 SetCairoFileName 和 SelectRenderer 函数

语法

Delphi

Function TPDFlib.RenderDocumentToFile(DPI: Double; StartPage, EndPage, Options: Integer; Const FileName: WideString): Integer;

ActiveX

Function PDFlib::RenderDocumentToFile(DPI As Double, StartPage As Long, EndPage As Long, Options As Long, FileName As String) As Long

DLL

int DLRenderDocumentToFile(int InstanceID, double DPI, int StartPage, int EndPage, int Options, const wchar_t * FileName);

参数

DPI用于渲染的 DPI,值为 72 时,在缩放级别为 100% 的情况下会得到与 Acrobat 相同的结果
StartPage要打印的第一页
EndPage要打印的最后一页
Options0 = BMP 输出;1 = JPEG 输出;2 = WMF 输出;3 = EMF 输出;4 = EPS 输出;5 = PNG 输出;6 = GIF 输出;7 = TIFF 输出;8 = EMF+ 输出;9 = HTML5 输出;10 = G4 TIFF 输出;用于文件的路径和文件名,每个页面将存储在单独文件中,若此参数包含 "%p",则替换为页码,否则在扩展名前追加页码,例如 FileName 为 "output.jpg" 且渲染第 10 页时,图像将存储为 "output10.jpg",若 FileName 为 "page%poutput.bmp" 且渲染第 5 页时,图像将存储为 "page5output.bmp"
FileName

返回值

0页面未能成功渲染。这通常是因为 StartPage 或 EndPage 参数超出范围
1页面已成功渲染