RenderPageToMemory
Rendering and printing
Description
Renders one page into a caller-supplied bitmap memory buffer when the PDFium renderer is selected.
Syntax
Delphi
Function TPDFlib.RenderPageToMemory(DPI: Double; Page: Integer; Target: Pointer; Width, Height, BitsPerPixel: Integer): Integer;
Parameters
| DPI | Requested rendering resolution before the current render scale is applied. |
|---|---|
| Page | 1-based page number. Values outside the document range are clamped to the nearest valid page. |
| Target | Pointer to the destination pixel buffer supplied by the caller. |
| Width | Destination bitmap width in pixels. |
| Height | Destination bitmap height in pixels. |
| BitsPerPixel | Pixel format depth. Only 24 and 32 are accepted. |
Return values
Returns 1 when PDFium renders into the buffer. Returns 0 for unsupported bit depths, when Cairo is selected, when PDFium is unavailable, or when rendering fails.
Remarks
SelectRenderer(3) for PDFium or SelectRenderer(2) for Cairo must be active. The page is scaled to fill the entire Width by Height buffer. Rows are written top-down with a packed stride of Width * BitsPerPixel / 8 bytes in blue, green, red order, followed by an alpha byte for 32-bit output
With Cairo, a page that renders smaller than the buffer at the requested DPI is rendered again at a higher resolution and the result is then resampled to the exact buffer size; 32-bit Cairo output is fully opaque. The buffer must hold at least Width * Height * BitsPerPixel / 8 bytes
See also
SetPDFiumFileName, SelectRenderer, PDFiumRendering, SetCairoFileName