API referenceCore SDK

pdfInsertBMPFromHandle

Insert a live GDI HBITMAP handle directly as an image,

C
int32_t __stdcall pdfInsertBMPFromHandle(PPDF IPDF, double PosX, double PosY, double ScaleWidth, double ScaleHeight, void* Handle);
Delphi
function pdfInsertBMPFromHandle(const IPDF: PPDF; PosX, PosY, ScaleWidth, ScaleHeight: Double; Handle: Pointer): Integer; stdcall;

Purpose. Insert a live GDI HBITMAP handle directly as an image, converting it to BMP bytes in-process (ViewerHBitmapToBMP) before routing through the same InsertBufferImage path used by pdfInsertImageFromBuffer (Image Insertion and Replacement) — the bitmap counterpart of pdfInsertMetafileFromHandle (Metafile Insertion (EMF/WMF)).

Parameters.

ParameterDescription
IPDFDocument handle.
PosX, PosY, ScaleWidth, ScaleHeightPlacement box.
HandleA live GDI HBITMAP (Windows-only; caller retains ownership).

Return value. The new image handle; 0 if the conversion failed or IPDF is invalid.

See also. pdfInsertImageFromBuffer.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfInsertBMPFromHandle(IntPtr IPDF, double PosX, double PosY, double ScaleWidth, double ScaleHeight, IntPtr Handle);
Area
Core SDK
Category

Core

Exported names

pdfInsertBMPFromHandle

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.