DARenderPageToFile
Direct access functionality, Rendering and printing
Description
Renders one Direct Access page to an image file using the renderer selected with SelectRenderer
The destination is replaced only after rendering and writing succeed
Returns 1 on success, 0 for a render failure, or 2 when the destination cannot be created
Renderer 1 uses the internal renderer, renderer 2 uses Cairo, and renderer 3 uses PDFium when the corresponding backend is available in the build
Configure optional libraries with SetCairoFileName or SetPDFiumFileName before selecting them
Pending Direct Access edits are included, the source handle remains open, and rendering does not update its modification date
PDFium supports BMP, JPEG, PNG, GIF, TIFF, and G4 TIFF raster output; other formats fail explicitly
Syntax
Delphi
Function TPDFlib.DARenderPageToFile(FileHandle, PageRef, Options: Integer; DPI: Double; Const FileName: WideString): Integer;
ActiveX
Function PDFlib::DARenderPageToFile(FileHandle As Long, PageRef As Long, Options As Long, DPI As Double, FileName As String) As Long
DLL
int DLDARenderPageToFile(int InstanceID, int FileHandle, int PageRef, int Options, double DPI, const wchar_t* FileName);
int DLDARenderPageToFileA(int InstanceID, int FileHandle, int PageRef, int Options, double DPI, const char* FileName);
Parameters
| FileHandle | A handle returned by the DAOpenFile, DAOpenFileReadOnly or DAOpenFromStream functions |
|---|---|
| PageRef | A page reference returned by the DAFindPage or DANewPage functions |
| Options | PDF_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) |
| DPI | The DPI to use when rendering the page. Values over 300 will cause excessive memory usage |
| FileName | The path and file name of the file to create to store the rendered page image data in |
Return values
| 0 | The page could not be rendered. Check the value of the FileHandle and PageRef parameters |
|---|---|
| 1 | The page was rendered correctly and the image file was saved to disk |
| 2 | The file could not be written to disk |