API reference › PDF/A & Conformance
pdfAddImage
The lowest-level raw image insertion primitive — embed a
BOOL32 __stdcall pdfAddImage(PPDF IPDF, TCompressionFilter Filter, uint32_t Flags, TPDFImage* Image);
function pdfAddImage(const IPDF: PPDF; Filter: TCompressionFilter; Flags: Cardinal; var Image: TPDFImage): LongBool; stdcall;
Purpose. The lowest-level raw image insertion primitive — embed a caller-supplied raw (undecoded-format, pre-decoded pixel) buffer directly as an image XObject, bypassing any file/format decoding.
Description. Computes bits-per-component from Image.BitsPerPixel div Image.NumComponents (so BitsPerPixel here means *total* bits across all components, not per-component depth — a caller must supply the combined value). Genuinely honors the per-call Filter: it temporarily overrides the document's default compression filter for the duration of this one call (SetCompressionFilter/restore in a try/finally), so AddRawImageH captures this specific image's requested filter into its own image-entry state without leaving a lasting side effect on the document's own default filter setting for subsequent operations.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
Filter | Compression filter for this image only (temporarily overrides, then restores, the document default). |
Flags | Accepted; not traced further in this chapter. |
Image | Raw pixel buffer + Width/Height/BitsPerPixel (total, not per-component)/NumComponents. |
Return value. True if NumComponents > 0 and the raw image was successfully registered.
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Content Creation
pdfAddImage
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.