pdfReadImageFormatEx
Read geometry from an in-memory Windows GDI bitmap handle
BOOL32 __stdcall pdfReadImageFormatEx(PPDF IPDF, void* hBitmap, uint32_t* Width, uint32_t* Height, int32_t* BitsPerPixel, int32_t* UseZip);
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.
| Parameter | Description |
|---|---|
IPDF | Document handle (unused for the read itself). |
hBitmap | A Windows HBITMAP handle. |
Width, Height | Output: pixel dimensions from GetObject. |
BitsPerPixel | Output: from GetObject's bitmap info. |
UseZip | Output: always 0. |
Return value. True if GetObject resolved the handle successfully; False for an invalid/null hBitmap.
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Core
pdfReadImageFormatEx
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.