DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: detect color in pdf  (Read 8,490 times)

kalos

  • Member
  • Joined in 2006
  • **
  • Posts: 1,824
detect color in pdf
« on: April 06, 2012, 07:15 PM »
hello!

is it possible to detect if a pdf file has any non-black color? ie. it is not black and white?

thanks!

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,565
Re: detect color in pdf
« Reply #1 on: April 06, 2012, 09:49 PM »
congratulations on your membership :-)
Sorry to hear you are colour blind :-(

kalos

  • Member
  • Joined in 2006
  • **
  • Posts: 1,824
Re: detect color in pdf
« Reply #2 on: April 07, 2012, 10:25 PM »
anyone??

x16wda

  • what am I doing in this handbasket?
  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
    • Participated in NANY Challenge Once
Re: detect color in pdf
« Reply #3 on: April 07, 2012, 10:40 PM »
what about grayscale, would that count?
vi vi vi - editor of the beast

kalos

  • Member
  • Joined in 2006
  • **
  • Posts: 1,824
Re: detect color in pdf
« Reply #4 on: April 07, 2012, 10:55 PM »
what about grayscale, would that count?

I want to distinguish pdfs that contain black characters, lines, table borders, etc, from those containing any grayscale or other color apart from black and white

x16wda

  • what am I doing in this handbasket?
  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
    • Participated in NANY Challenge Once
Re: detect color in pdf
« Reply #5 on: April 07, 2012, 11:52 PM »
OK, next question, what is the framework?  Do you want a batch utility to do this and return a result you can check, or documentation on what to look for to incorporate into a routine you are writing, or ??
vi vi vi - editor of the beast

kalos

  • Member
  • Joined in 2006
  • **
  • Posts: 1,824
Re: detect color in pdf
« Reply #6 on: April 07, 2012, 11:56 PM »
yes, a utility or any other way to inform me that the pdf is only black and white
it would be best not to have to open the pdf (since it will be a batch process and it must be fast and quiet)
also checking the colors of its pixels, may not be accurate enough

kalos

  • Member
  • Joined in 2006
  • **
  • Posts: 1,824
Re: detect color in pdf
« Reply #7 on: April 12, 2012, 12:27 PM »
anyone?

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,970
    • Gathering Badge
    • Participated in NANY Challenge Once
Re: detect color in pdf
« Reply #8 on: April 12, 2012, 01:09 PM »
I'm curious why you need this kalos.

Related:
A few years back I sent a PDF for publication, it was vector "line-art" (black only) with "Black" text - it should have been treated as a one colour (Black) print, but for some reason the file insisted on been treated as full colour at their end (or maybe it was their layout software that insisted on treating it so). I dont really have much experience in this field, and the person I was dealing with at the publishers didnt really seem to be much of an expert either. We narrowed it down to the text, but couldnt figure out why it was so (as said, it was simply black text). To be honest I cant remember what exactly our solution was, we converted the file to "greyscale"/Black in some manner.

So, anyways, just curious :)
Also, if there is a solution, I'll certainly have a go at checking some PDFs... out of cusiousity :p
Tom

kalos

  • Member
  • Joined in 2006
  • **
  • Posts: 1,824
Re: detect color in pdf
« Reply #9 on: April 12, 2012, 03:03 PM »
One purpose would be my request long time ago, to send colored pages to color printer and the black ones to b/w printer

But, moreover, now, and I have a program that outputs pdfs, and and if it has a colored element, and it means that it belongs to a certain category and must be treated specifically

For automation purposes in brief.. :)

Original address: https://www.donationcoder.com/forum/index.php?topic=30566.0