API referenceForms

pdfReadImageFormatEx

Read geometry from an in-memory Windows GDI bitmap handle

C
BOOL32 __stdcall pdfReadImageFormatEx(PPDF IPDF, void* hBitmap, uint32_t* Width, uint32_t* Height, int32_t* BitsPerPixel, int32_t* UseZip);
Delphi
function pdfReadImageFormatEx(const IPDF: PPDF; hBitmap: Pointer; var Width, Height: Cardinal; var BitsPerPixel, UseZip: Integer): LongBool; stdcall;

Purpose. Read geometry from an in-memory Windows GDI bitmap handle (HBITMAP) instead of a file — for callers who already have a loaded bitmap (e.g. from a screen capture or another GDI operation) and want its dimensions without a round trip through a file.

Description. A different code path entirely from the file/buffer variants — no LoadImageFile/LoadImageFromBuffer call at all. Resolves geometry purely via GDI GetObject on the HBITMAP (ReadHBitmapFormat). UseZip is always 0 here (hardcoded, not derived from any format inspection — an HBITMAP has no compression format of its own to report).

Parameters.

ParameterDescription
IPDFDocument handle (unused for the read itself).
hBitmapA Windows HBITMAP handle.
Width, HeightOutput: pixel dimensions from GetObject.
BitsPerPixelOutput: from GetObject's bitmap info.
UseZipOutput: always 0.

Return value. True if GetObject resolved the handle successfully; False for an invalid/null hBitmap.

C# (P/Invoke)

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

Core

Exported names

pdfReadImageFormatEx

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.