DARenderPageToString
Direct access functionality, Rendering and printing
Description
Renders one Direct Access page to encoded image bytes using the renderer selected with SelectRenderer
Returns an empty string on failure; inspect LastRenderError to distinguish an invalid handle, unavailable backend, unsupported output format, and rendering failure
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.DARenderPageToString(FileHandle, PageRef, Options: Integer; DPI: Double): AnsiString;
DLL
const char* DLDARenderPageToString(int InstanceID, int FileHandle, int PageRef, int Options, double DPI);
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 |
Return values
Returns the rendered page as encoded image bytes. Returns an empty string on failure; inspect LastErrorCode for the reason.