1. Home
  2. Foxit Quick PDF Library
  3. How can I programmatically detect color PDF files versus black and white PDF files?

How can I programmatically detect color PDF files versus black and white PDF files?

One method is to render each page to an image file and then check each pixel for RGB values not equal to each other. If R=G=B for each pixel then it’s a grayscale image.

This should allow you to determine if a PDF file is color or black and white.

There isn’t a document wide setting that could help you determine if a PDF has color or is just black and white, as various different objects have their own properties.

Updated on March 26, 2017

Was this article helpful?

Related Articles

Ready to try Foxit PDF SDK?
Click the link below to download your trial
Free Trial