API referenceImages

pdfPlaceImage

Place an already-registered image (from pdfCreateImage, or

C
BOOL32 __stdcall pdfPlaceImage(PPDF IPDF, int32_t ImgHandle, double PosX, double PosY, double ScaleWidth, double ScaleHeight);
Delphi
function pdfPlaceImage(const IPDF: PPDF; ImgHandle: Integer; PosX, PosY, ScaleWidth, ScaleHeight: Double): LongBool; stdcall;

Purpose. Place an already-registered image (from pdfCreateImage, or re-place one already placed via pdfInsertImage) onto the current page at a given position/size.

Description. Looks up ImgHandle in FImages; on a match, writes a Do XObject placement operator into the current page's content stream at PosX/PosY sized ScaleWidth/ScaleHeight (a <= 0 scale value defaults to the image's native pixel size, same convention as pdfInsertImage). Because this only requires the handle to exist in the document-wide image registry — not that it was placed via this exact document's staged-image slot — the same image handle can be placed multiple times, on multiple pages, at different positions, each call emitting a fresh, independent Do reference to the same underlying image XObject (the image data itself is shared/embedded once, not duplicated).

Parameters.

ParameterDescription
IPDFDocument handle.
ImgHandleHandle of an already-registered image (from pdfCreateImage, pdfInsertImage, etc).
PosX, PosY, ScaleWidth, ScaleHeightPlacement box on the current page.

Return value. True if ImgHandle resolved and the current page accepted the placement; False if there is no open page or the handle is unknown.

See also. pdfCreateImage.

C# (P/Invoke)

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

Core

Exported names

pdfPlaceImage

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.