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

DynaPDF.IsColorPage

Checks whether a page is a color page or if all graphic elements of the page use black & white only.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 5.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.IsColorPage"; PDF { ; GrayIsColor } )   More

Parameters

Parameter Description Example Flags
PDF The PDF reference returned from DynaPDF.New. $pdf
GrayIsColor Boolean whether gray should count as color.
Default is 0.
Pass 1 to count gray as color.
0 Optional

Result

Returns 1, 0 or error.

Description

Checks whether a page is a color page or if all graphic elements of the page use black & white only.
If the parameter GrayIsColor is true, gray shades are treated as color. The page which should be checked must be opened with the function DynaPDF.EditPage beforehand.
Complex color spaces such as Lab, Separation, DeviceN, Colored Tiling Patterns, and Shadings are always treated as color. The function does not return when a color is set, the color must be used by an object.
If an object of the page uses a color, the return value is 1. If no object uses a color the return value is 0.

See also DynaPDF.IsEmptyPage.

See also IsColorPage function in DynaPDF manual.

Examples

Check if first page has color:

Set Variable [ $pdf ; Value: MBS("DynaPDF.New") ]
# Load PDF from container
Set Variable [ $r ; Value: MBS("DynaPDF.OpenPDFFromContainer"; $pdf; Start::SourcePDF) ]
Set Variable [ $r ; Value: MBS("DynaPDF.ImportPDFFile"; $pdf) ]
# Query image list
Set Variable [ $r ; Value: MBS("DynaPDF.EditPage"; $pdf; 1) ]
Show Custom Dialog [ MBS( "DynaPDF.IsColorPage"; $PDF ) ]
Set Variable [ $r ; Value: MBS("DynaPDF.EndPage"; $pdf) ]
Set Variable [ $r ; Value: MBS("DynaPDF.Release"; $pdf) ]

See also

Release notes

Blog Entries

This function checks for a license.

Created 6th February 2015, last changed 9th November 2021


DynaPDF.InsertMetafileEx - DynaPDF.IsEmptyPage