API referenceRendering & Viewer

pdfRenderPageToImage

Render one page of the currently open document directly

C
BOOL32 __stdcall pdfRenderPageToImageA(PPDF IPDF, uint32_t PageNum, const char* OutFile, uint32_t Resolution, int32_t Width, int32_t Height, TRasterFlags Flags, TPDFPixFormat PixFmt, TCompressionFilter Filter, TImageFormat Format);
BOOL32 __stdcall pdfRenderPageToImageW(PPDF IPDF, uint32_t PageNum, const wchar_t* OutFile, uint32_t Resolution, int32_t Width, int32_t Height, TRasterFlags Flags, TPDFPixFormat PixFmt, TCompressionFilter Filter, TImageFormat Format);
Delphi
function pdfRenderPageToImageA(const IPDF: PPDF; PageNum: Cardinal; const OutFile: PAnsiChar; Resolution: Cardinal; Width, Height: Integer; Flags: TRasterFlags; PixFmt: TPDFPixFormat; Filter: TCompressionFilter; Format: TImageFormat): LongBool; stdcall;
function pdfRenderPageToImageW(const IPDF: PPDF; PageNum: Cardinal; const OutFile: PWideChar; Resolution: Cardinal; Width, Height: Integer; Flags: TRasterFlags; PixFmt: TPDFPixFormat; Filter: TCompressionFilter; Format: TImageFormat): LongBool; stdcall;

Purpose. Render one page of the currently open document directly to an image file (BMP or baseline TIFF) — the file-export convenience entry point, using the separate RenderPageBMP engine rather than the engine .

Description. Delegates entirely to RenderPageBMP(IPDF, PageNum, OutFile, Resolution, Width, Height, Format), which computes pixel dimensions from Width/Height if positive, else from Resolution (default 150 DPI if 0) against the page's own media box; builds a full TRenderResources set (imported fonts, images, forms, ExtGStates, shadings, Separation colorspaces, placed templates, annotation appearance streams — a notably richer resource set than the simple fallback used by pdfRenderPage's IRAS-less path); and writes the result as baseline TIFF (Format = ifmTIFF/ifmBigTIFF) or BMP (everything else — Format values other than TIFF/BigTIFF all collapse to BMP output regardless of the requested format, e.g. requesting ifmPNG or ifmJPEG here silently produces a .bmp-layout file at the given path). PixFmt and Filter are accepted by the ABI but never read — output is always 24-bit RGB (BMP) or whatever WriteBaselineTIFF itself hardcodes; there is no grayscale/1-bit/ compressed output path here despite the parameters existing (contrast pdfRenderAnnotOrField below, which genuinely honors PixFmt).

Parameters.

ParameterDescription
IPDFDocument handle.
PageNum1-based page number to render.
OutFileOutput file path.
ResolutionDPI used only when Width/Height are both ≤ 0; defaults to 150 if 0.
Width, HeightExplicit output pixel size; takes priority over Resolution when both > 0.
FlagsAccepted; not observed to affect this path's output.
PixFmtAccepted but never read — output is always the format's native depth.
FilterAccepted but never read.
FormatOnly ifmTIFF/ifmBigTIFF are distinguished; every other value silently produces BMP.

Return value. True on successful render + write; False on any failure (bad page, zero computed dimensions, write failure).

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Rendering & Viewer
Category

Core

Exported names

pdfRenderPageToImageA pdfRenderPageToImageW

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.