API referenceGraphics

pdfGetColorSpaceObjEx

Read a full color-space descriptor by registered handle

C
BOOL32 __stdcall pdfGetColorSpaceObj(PPDF IPDF, uint32_t Handle, TPDFColorSpaceObj* CS);
BOOL32 __stdcall pdfGetColorSpaceObjEx(void* IColorSpace, TPDFColorSpaceObj* CS);
Delphi
function pdfGetColorSpaceObj(const IPDF: PPDF; Handle: Cardinal; var CS: TPDFColorSpaceObj): LongBool; stdcall;
function pdfGetColorSpaceObjEx(const IColorSpace: Pointer; var CS: TPDFColorSpaceObj): LongBool; stdcall;

Purpose. Read a full color-space descriptor by registered handle (pdfGetColorSpaceObj) or by a previously-minted object handle (pdfGetColorSpaceObjEx).

Description. pdfGetColorSpaceObj looks up Handle via GetColorSpaceInfo (color-space type, alternate space, component count) and fills CS.ColorSpaceType, CS.Alternate, and CS.Handle. It additionally mints (GAP-7 pattern, matching the object-descriptor mechanism used elsewhere in the SDK for lazily-exposed sub-objects) two or three fresh object handles into the output struct: CS.IColorSpaceObj (this space's own descriptor, Sub=0), CS.IAlternate (its alternate/base device space, Sub=1), and — only when the color space's type is DeviceN (ct = 10, esDeviceN) — CS.IAttributes (the DeviceN process-color attributes, readable separately via pdfGetDeviceNAttributes). pdfGetColorSpaceObjEx is the read-back half: given one of those minted IColorSpaceObj/ IAlternate handles, it resolves the originating descriptor and re-fills CSSub=0 re-describes the space itself, Sub=1 describes its alternate. Passing an IColorSpace handle that wasn't minted by pdfGetColorSpaceObj (or one already released) fails.

Parameters.

ParameterDescription
IPDF*(Obj only)* Document handle.
Handle*(Obj only)* Registered color-space handle (>= CS_HANDLE_BASE).
IColorSpace*(ObjEx only)* An object handle previously minted into CS.IColorSpaceObj/CS.IAlternate by pdfGetColorSpaceObj.
CSOutput descriptor: type, alternate space, handle, and (for Obj) freshly-minted IColorSpaceObj/IAlternate/IAttributes sub-handles.

Return value. True if the handle resolved and CS was filled; False otherwise (unknown handle, IPDF invalid, or CS is a null pointer for Obj).

Remarks. IAttributes is populated only for DeviceN spaces; for every other color-space kind it is left as 0/unset in the output struct.

See also. pdfGetColorSpaceCount.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Graphics
Category

Getters

Exported names

pdfGetColorSpaceObjEx

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.