Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
DynaPDF.SetColorSpace
The function activates a device color space in the graphics state.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 3.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
The PDF reference returned from DynaPDF.New. | ||
Value | The new colorspace. Can be DeviceRGB, DeviceCMYK or DeviceGray. | "DeviceGray" |
Result
Returns OK on success or error message.
Description
The function activates a device color space in the graphics state.All color values must be defined in the current color space. Images or EMF graphics are automatically converted to the current color space. The default color conversion rules can be modified with the function DynaPDF.SetGStateFlags.
Extended color spaces can be set with DynaPDF.SetExtColorSpace, DynaPDF.SetExtFillColorSpace, and DynaPDF.SetExtStrokeColorSpace.
See also DynaPDF.GetColorSpace.
See also SetColorSpace function in DynaPDF manual.
Examples
Set to RGB:
MBS( "DynaPDF.SetColorSpace"; $PDF; "DeviceRGB" )
Set to CMYK:
MBS( "DynaPDF.SetColorSpace"; $PDF; "DeviceCMYK" )
Write in CMYK:
# switch to CMYK
Set Variable [$r; Value:MBS( "DynaPDF.SetColorSpace"; $pdf; "DeviceCMYK" )]
# set color to Cyan
Set Variable [$r; Value:MBS("DynaPDF.SetFillColor"; $pdf; 1; 0; 0; 0)]
# Write some text
Set Variable [$r; Value:MBS("DynaPDF.WriteText"; $pdf; 100; $x; "Some cyan text")]
# now switch back to RGB
Set Variable [$r; Value:MBS( "DynaPDF.SetColorSpace"; $pdf; "DeviceRGB" )]
See also
- DynaPDF.GetColorSpaceCount
- DynaPDF.GetColorSpaceInfo
- DynaPDF.HighlightAnnot
- DynaPDF.RGB
- DynaPDF.SetExtColorSpace
- DynaPDF.SetExtFillColorSpace
- DynaPDF.SetFillColor
- DynaPDF.SetGStateFlags
- DynaPDF.WriteFText
- DynaPDF.WriteFTextEx
Example Databases
- DynaPDF/Create PDF with Bezier Curves
- DynaPDF/Picture to PDF
- DynaPDF/Shrink PDF pages
- DynaPDF/Watermark pages
This function checks for a license.
Created 18th August 2014, last changed 12nd November 2018