DynaPDF Manual - Page 271

Previous Page 270   Index   Next Page 272

Function Reference
Page 271 of 777
The parameter Color specifies the alternate color value, defined in the alternate color space, which is
used if the device does not support the colorant.
A color value in a Separation color space consists of a single tint component in the range 0 to 255.
The value 0 represents the minimum amount of colorant that can be applied; 255 represent the
maximum. Tints are always treated as subtractive colors, even if the device produces output for the
designated component by an additive method. Thus, a tint value of 0 denotes the lightest color that
can be achieved with the given colorant, and 255 is the darkest. This convention is the same as for
DeviceCMYK color components but opposite to the one for DeviceGray and DeviceRGB.
Encoding of Colorant Names
Colorant names are interpreted in the code page 1252 (WinAnsi) by default. Because colorant names
are stored in UTF-8 Unicode format in PDF, it is also possible to pass UTF-8 encoded Unicode strings
to the function. However, the function must be able to distinguish between both string formats. To
achieve this, the parameter Handle accepts the special flag 0x10000000 that specifies that the
parameter Colorant contains a UTF-8 encoded string. The flag must be combined with the handle as
handle |= 0x10000000;
// C/C++, C#
= handle Or &H10000000 // Visual Basic
handle := handle or $10000000
// Delphi
If the alternate color space is a device color space, simply set the parameter to 0x10000000 to specify
that the colorant name is a UTF-8 string.
Non-device color spaces cannot be used for interactive objects such as annotations or form fields. The
active color space must always be changed to a device color space before creating interactive objects;
see SetColorSpace(). Note also that annotations support DeviceRGB only. Form fields support
DeviceGray, DeviceRGB, and DeviceCMYK.
Use the function SetExtColorSpace() to activate the color space in the graphics state. To set a color of
a Separation space pass the wished color value to SetFillColor(), SetStrokeColor(), or SetColors().
Return values:
If the function succeeds the return value is the color space handle, a value greater or equal zero. If
the function fails the return value is a negative error code.
SI32 pdfCreateSetOCGStateAction(
const PPDF* IPDF, // Instance pointer
UI32* On,
// Array of OCG handles which should be set to On
UI32 OnCount,
// Number of OCGs handles in the On array

Previous topic: CreateSeparationCS

Next topic: CreateSigField, How to lock an Interactive Form after signing?