BOOL32 __stdcall pdfGetAnnotColor(PPDF IPDF, uint32_t Handle, TAnnotColor ColorType, TPDFColorSpace* CS, uint32_t* Color);
BOOL32 __stdcall pdfSetAnnotColor(PPDF IPDF, uint32_t Handle, TAnnotColor ColorType, TPDFColorSpace CS, uint32_t Color);
function pdfGetAnnotColor(const IPDF: PPDF; Handle: Cardinal; ColorType: TAnnotColor; var CS: TPDFColorSpace; var Color: Cardinal): LongBool; stdcall;
function pdfSetAnnotColor(const IPDF: PPDF; Handle: Cardinal; ColorType: TAnnotColor; CS: TPDFColorSpace; Color: Cardinal): LongBool; stdcall;
Purpose. Set/get an annotation's border color (ColorType=1, PDF /C) or interior fill color (ColorType=0, PDF /IC).
Description. Verified: colors in this SDK's annotation storage are always RGB, regardless of the CS parameter on either side. pdfSetAnnotColor's CS parameter is accepted by the ABI but never passed through to the underlying SetAnnotColorTypeH — the color is always written as a 3-component RGB array (ColorArray(Color)) into /IC or /C, no matter what color space CS specifies. Symmetrically, pdfGetAnnotColor always forces its output CS to csDeviceRGB unconditionally on success — it never reads back or infers an actual stored color-space kind (there isn't one to infer, since only RGB is ever written). A caller passing csDeviceCMYK or csDeviceGray to pdfSetAnnotColor will not get an error, but the value is silently reinterpreted/stored as RGB regardless.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
Handle | Document-wide annotation handle. |
ColorType | 0 = interior/fill color (/IC); non-zero = border/stroke color (/C). |
CS | Accepted but never honored — storage and readback are always RGB regardless of this value. |
Color | Packed RGB color value. |
Return value. True if Handle resolves and the target color key exists (Get) / was written (Set); False otherwise.
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Annotations
pdfGetAnnotColor
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.