Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 8.4   8.5   9.0   9.1   9.2   9.3   9.4   9.5   10.0   10.1    Statistic  


Converts colors to gray.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
DynaPDF 9.2 Yes Yes Yes Yes Yes
MBS( "DynaPDF.ConvertColors"; PDF; Flags { ; Add } )   More


Parameter Description Example value
PDF The PDF reference returned from DynaPDF.New. $pdf
Flags The mode to operate.
Can be BW_To_Gray (RGB and B/W to gray), RGB_To_Gray (RGB to gray), ToGrayAdjust (Lighten or darken colors).
Add Optional
The value for ToGrayAdjust flag.


Returns OK or error.


Converts colors to gray.
The function converts inline RGB operators in the current open page to gray. At time of publication only inline operators like g, rg, G, and RG are processed. CMYK colors will be left unchanged. The parameter Add is optional and considered only if the constant ToGrayAdjust is used.
The conversion of RGB inline color operators can be useful if the document was created with a GDI application, e.g. Microsoft Word, Excel and so on and if the file must be split into black & white and color pages. DynaPDF.IsColorPage can then be used to determine whether the page contains still colored objects. The advantage is that RGB black & white values, which are used for text and vector graphics, are already removed so that DyanPDF.IsColorPage returns only true if any other object uses a color, e.g. an image.
The constant ToGrayAdjust can be used to convert RGB colors to gray and to darken or lighten RGB and gray colors. The parameter Add must be a pointer of a floating point variable. The value can be in the range -1.0 through 1.0. Colors in PDF are stored as floating point values in the range 0.0 through 1.0. Since DeviceGray is an additive color space, 0 denotes black and 1.0 white. If all color operators should be set to black for example, then set the variable to -1.0. The function performs a range check. If the color becomes out of range then it will be adjusted to the nearest value that is inside the allowed color range.

See also ConvertColors function in DynaPDF manual.

See also

Blog Entries

Release notes

Created 17th April 2019, last changed 17th April 2019

DynaPDF.ClosePath   -   DynaPDF.ConvertStyledText

Feedback: Report problem or ask question.

MBS FileMaker tutorial videos