RenderPageToStreamEx
Rendering and printing
Description
Renders the full effective page box to a caller-owned, seekable stream and reports its raster geometry
Syntax
function TPDFlib.RenderPageToStreamEx(DPI: Double; Page: Integer;
const Options: TPDFlibPageRasterOptions; Target: TStream;
out Info: TPDFlibPageRasterInfo): Integer;
Parameters
| DPI, Page | A positive finite resolution and a 1-based page number |
|---|---|
| Options | A TPDFlibPageRasterOptions value selecting the raster format, page box, background, optional-content mode, DPI policy and backend-difference policy |
| Target | A caller-owned seekable stream replaced with the encoded image and reset to its start on success |
| Info | An output TPDFlibPageRasterInfo receiving the raster geometry and effective rendering choices |
Supply a positive finite DPI and a 1-based page number. Select the raster format and page box using TPDFlibPageRasterOptions. The output bounds start at zero and span the full rotated effective page box
Physical DPI
Set Options.DPIMode to PDF_RASTER_DPI_PHYSICAL to apply the PDF page's /UserUnit. Each default user-space unit measures UserUnit / 72 inch. For example, a 100-by-50-unit page box with /UserUnit 2 produces a 200-by-100-pixel image at 72 DPI with render scale 1. A 90-degree page rotation swaps the output dimensions
Info.OutputDPI is the requested DPI multiplied by the render scale. The image stores that density when the format supports it, subject to the format's rounding. Info.RasterDPI also includes the page unit and determines pixel geometry. An absent page unit defaults to 1. A present invalid value causes a physical-DPI request to fail
The region and tile entry points use the same physical grid with the same options. Tile inputs are pixel coordinates. Region inputs remain default PDF user-space coordinates
With PDFium selected, the report and fallback policies use the built-in renderer in physical mode. The strict policy rejects that combination
Return values
Returns 1 and resets the stream to the start of the image. Returns 0 on rejection or rendering failure. The original RenderPageToStream retains its established DPI behavior
Use RenderPageToFileEx to publish the same image to a file