BOOL32 __stdcall pdfCreateImageA(PPDF IPDF, const char* FileName, TImageFormat Format);
BOOL32 __stdcall pdfCreateImageW(PPDF IPDF, const wchar_t* FileName, TImageFormat Format);
function pdfCreateImageA(const IPDF: PPDF; const FileName: PAnsiChar; Format: TImageFormat): LongBool; stdcall;
function pdfCreateImageW(const IPDF: PPDF; const FileName: PWideChar; Format: TImageFormat): LongBool; stdcall;
Purpose. Load and register an image from a file without placing it on any page — for deferred placement via pdfPlaceImage, or attachment to a form field/annotation appearance elsewhere in the ABI.
Description. Decodes and registers the image exactly like pdfInsertImage's internals, but skips the placement step entirely; the new handle is also cached as FStagedImage (the "most recently staged, not yet placed" image, consulted by whatever staged-image consumer needs an implicit target — not otherwise exposed through this ABI). The Format parameter (TImageFormat, presumably meant to force a specific decoder — JPEG vs PNG vs BMP, etc. — rather than relying on auto-detection) is accepted by the ABI but never read; the file's actual content is always auto-sniffed by LoadImageFile regardless of what Format specifies. Despite the ABI's BOOL32 return type, the underlying handle allocation (CreateImageFromFile, shared with the internal machinery behind pdfInsertImage) returns an Integer handle — the wrapper reduces this to True/False (> 0), so the actual new handle number is not directly recoverable from this call's return value; retrieve it via whatever "most recently created image" query exists elsewhere (not in this chapter), or use pdfInsertImage/pdfPlaceImage in combination instead if the handle is needed immediately.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
FileName | Path to the image file. |
Format | Accepted but never read — format is always auto-detected from file content regardless of this value. |
Return value. True if the file loaded and registered successfully; False otherwise. The new handle itself is not returned.
See also. pdfPlaceImage.
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Object Creation
pdfCreateImageA
pdfCreateImageW
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.