RenderPageToFile

Rendering and printing

Description

This function renders a page from the selected document to a file on disk. The data written to disk depends on the Options parameter.

By default rendering uses the GDI+ system which is available by default in Windows XP and later.

The GDI+ and Cairo renderers support PDF shading types 1 and 4-7 with adaptive function sampling, source-space colour interpolation, BBox clipping, Background fills, transparency, and bounded mesh subdivision.

Option 10, TIFF (G4) output, is only available on Windows Vista and Windows Server 2008 and later.

It is also possible to render using Cairo, use the SetCairoFileName and SelectRenderer

functions

For images with /Alternates, the built-in renderer keeps a visible base image or selects the first visible optional-content alternate as required by ISO 32000-1

Syntax

Delphi

Function TPDFlib.RenderPageToFile(DPI: Double; Page, Options: Integer; Const FileName: WideString): Integer;

ActiveX

Function PDFlib::RenderPageToFile(DPI As Double, Page As Long, Options As Long, FileName As String) As Long

DLL

int DLRenderPageToFile(int InstanceID, double DPI, int Page, int Options, const wchar_t * FileName);

Parameters

DPIThe DPI to use when rendering the page. Values over 300 will cause excessive memory usage.
PageThe page number to render
OptionsPDF_RENDER_BMP = 0 (BMP output), PDF_RENDER_JPEG = 1 (JPEG output), PDF_RENDER_WMF = 2 (WMF output), PDF_RENDER_EMF = 3 (EMF output), PDF_RENDER_EPS = 4 (EPS output), PDF_RENDER_PNG = 5 (PNG output), PDF_RENDER_GIF = 6 (GIF output), PDF_RENDER_TIFF_RGB = 7 (TIFF output), PDF_RENDER_EMFPLUS = 8 (EMF+ output), PDF_RENDER_HTML5 = 9 (HTML5 output), PDF_RENDER_TIFF_G4 = 10 (G4 TIFF output), PDF_RENDER_EMF_DUAL = 11 (EMF+ Dual output)
FileNameThe path and file name of the file to create to store the rendered page image data in.

Return values

0The page could not be rendered
1The page was rendered correctly and the image file was saved to disk The file could not be written to disk 2