Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


Creates a DeviceN color space.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 7.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.CreateDeviceNColorSpace"; PDF; Colorants; NumColorants; PostScriptFunc; Alternate { ; Handle } )   More


Parameter Description Example Flags
PDF The PDF reference returned from DynaPDF.New. $pdf
Colorants Array of colorant names (required)
NumColorants Number of colorants in the array.
PostScriptFunc Postscript calculator function (required)
Alternate The alternate color space.
Can be DeviceRGB, DeviceCMYK, DeviceGray, CalGray, CalRGB, Lab, ICCBased, Pattern, Indexed, Separation, DeviceN, NChannel or the machting number value.
Handle Alternate color space handle or -1. Optional


Returns OK or error.


Creates a DeviceN color space.
DeviceN color spaces (PDF 1.3) can contain up to 32 color components. They provide greater flexibility than is possible with standard device color spaces such as DeviceCMYK or with individual Separation color spaces. For example, it is possible to create a DeviceN color space consisting of only the cyan, magenta, and yellow color components, with the black component excluded.
Colors of a DeviceN color space 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 the darkest. This convention is the same one as for DeviceCMYK color components but opposite to the one for DeviceGray or DeviceRGB.
DeviceN was designed to represent color spaces containing multiple components that correspond to colorants of some target device. As with Separation color spaces, PDF consumer applications must be able to approximate the colorants if they are not available on the current output device, such as a display. To accomplish this, the color space definition provides a tint transformation function that can be used to convert all the components to an alternate color space.
The tint transformation function consists of a PostScript calculator function that is called with n tint values and returns m color component values, where n is the number of components needed to specify a color in the DeviceN color space and m is the number of components required by the alternate color space.
Note: Painting in the alternate color space may produce a good approximation of the intended color when only opaque objects are painted. However, it does not correctly represent the interactions between an object and its backdrop when the object is painted with transparency or when overprinting is enabled (see also DynaPDF.CreateExtGState).
A DeviceN color space supports the special colorant name None which produces no visible output on the device. When a DeviceN color space is painting the named device colorants directly, color components corresponding to None colorants are discarded. However, when the DeviceN color space reverts to its alternate color space, those components are passed to the tint transformation function, which can use them as desired.
Note: A DeviceN color space whose component colorant names are all None always discards its output, just the same as a Separation color space for None; it never reverts to the alternate color space. Reversion occurs only if at least one color component (other than None) is specified and is not available on the device.
Encoding for colorants name is UTF-8.

See also CreateDeviceNColorSpace function in DynaPDF manual.


Create the DeviceN color space:

# Create Blend function (see dynapdf_help.pdf for how this was created)
Set Variable [ $PostScriptFunc ; Value: "{2 index 0.38 mul 2 index 0 add add 0 3 index 0.56 mul 0 add add 4 index 0.34 mul 0 4 index add add 0 0 0 add add 7 4 roll pop pop pop}" ]
Set Variable [ $cls ; Value: "PANTONE 345 CVC¶PANTONE 293 CVC¶Yellow" ]
Set Variable [ $cs ; Value: MBS("DynaPDF.CreateDeviceNColorSpace"; $pdf; $cls; 3; $PostScriptFunc; "DeviceCMYK"; -1) ]

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 27th August 2017, last changed 27th August 2017

DynaPDF.CreateDPartRoot - DynaPDF.CreateGeospatialMeasure