API referenceImages

pdfGetImageHandle

Resolve a PIMG standalone object handle back to its

C
int32_t __stdcall pdfGetImageHandle(PPDF IPDF, void* ImagePtr);
Delphi
function pdfGetImageHandle(const IPDF: PPDF; ImagePtr: Pointer): Integer; stdcall;

Purpose. Resolve a PIMG standalone object handle back to its originating document image handle, or (when ImagePtr is null) return the most recently inserted image's handle.

Description. Two distinct modes selected purely by whether ImagePtr is nil: with ImagePtr = nil, returns D.GetLastImageHandle — the document's most-recently-added image handle, regardless of what is currently "selected" via pdfSelectImage (a separate cursor, see below); with a non-null ImagePtr, resolves it as a PIMG (from pdfCreateImageObj) and returns the Handle that object remembered at mint time — this does not re-verify that the originating document image handle still exists or is unchanged; a PIMG snapshot outlives mutations to (or even replacement of) its source image.

Parameters.

ParameterDescription
IPDFDocument handle (only consulted in the ImagePtr = nil mode).
ImagePtrnil = query the last-inserted image; non-null = a PIMG from pdfCreateImageObj to resolve back to its origin handle.

Return value. The resolved image handle; -1 if IPDF is invalid (nil mode) or ImagePtr doesn't resolve to a live PIMG.

See also. pdfCreateImageObj, pdfSelectedImage (a third, independent "current image" concept — do not confuse the three).

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfGetImageHandle(IntPtr IPDF, IntPtr ImagePtr);
Area
Images
Category

Getters

Exported names

pdfGetImageHandle

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.