RenderPageToStream
Rendering and printing
Description
This function is only available in the Delphi edition. It renders a page from the selected document to a TStream object. The data placed into the stream depends on the Options parameter
By default rendering uses the GDI+ system which is available by default in Windows XP and later
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.
Built-in color-function limits
The built-in function evaluator rejects malformed arrays, truncated sample tables, cyclic function references, and excessive evaluation complexity
Sampled functions support 1, 2, 4, 8, 12, 16, 24, and 32 bits per sample, with at most 16 input dimensions and 8,388,608 sample values; recursive interpolation allows 65,536 visits per call
Function construction allows 64 nested factory calls and 65,536 function nodes; stitching functions allow at most 8,388,608 aggregate sampling steps
Calculator functions allow 64 procedure levels, 65,536 compiled tokens, and 4,096 stack values
External rendering engines apply their own limits
Syntax
Delphi
Function TPDFlib.RenderPageToStream(DPI: Double; Page, Options: Integer; Target: TStream): Integer;
Parameters
| DPI | The DPI to use when rendering the page. Values over 300 will cause excessive memory usage |
|---|---|
| Page | The page number to render |
| 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) |
| Target | The stream to place the rendered page into |
Return values
Returns 1 on success or 0 when rendering fails. Inspect LastRenderError for the renderer error, including a Type3 glyph recursion limit
Native bitmap encoding starts only after rendering succeeds, so a renderer error is not converted into a successful partial bitmap
Stream output
On Windows, the built-in BMP, PNG and GIF encoders require complete writes and propagate EWriteError when the target accepts fewer bytes than requested; partial output bytes are not rolled back
Built-in BMP output updates resolution relative to the stream position at entry, preserves an existing prefix and leaves the position at the end of the written bitmap