API referencePDF/A & Conformance

pdfAddImage

The lowest-level raw image insertion primitive — embed a

C
BOOL32 __stdcall pdfAddImage(PPDF IPDF, TCompressionFilter Filter, uint32_t Flags, TPDFImage* Image);
Delphi
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.

ParameterDescription
IPDFDocument handle.
FilterCompression filter for this image only (temporarily overrides, then restores, the document default).
FlagsAccepted; not traced further in this chapter.
ImageRaw 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)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
PDF/A & Conformance
Category

Content Creation

Exported names

pdfAddImage

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.