Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Detecting Colour in a PDF
  FAQ FAQ  Forum Search   Register Register  Login Login

Detecting Colour in a PDF

 Post Reply Post Reply
Author
Message
Doc-ItMan View Drop Down
Beginner
Beginner


Joined: 15 Nov 11
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Doc-ItMan Quote  Post ReplyReply Direct Link To This Post Topic: Detecting Colour in a PDF
    Posted: 24 Jul 12 at 3:09PM
Is there a function for detecting if a PDF has colour on any of the pages other than black and white?
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 24 Jul 12 at 9:22PM
Hi Doc!

There's no implemented function for this.
You can do it by your own. I've posted some code little time ago.
Use RenderPageToStream and put the content into a small (64 x 64 or so) bmp-image.
Now you can check the pixels if there's any other colour than black or white.
Here's the link:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2194&KW=Round%28pix%29&PID=9362&title=this-tif-cant-be-converto-pdf#9362

Cheers, Ingo

Back to Top
Doc-ItMan View Drop Down
Beginner
Beginner


Joined: 15 Nov 11
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Doc-ItMan Quote  Post ReplyReply Direct Link To This Post Posted: 24 Jul 12 at 9:30PM
Thanks for the help. It is interesting that there is no such function for this. I do not believe that the PDF Spec includes it either.
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 27 Jul 12 at 5:07AM
The closest and quickest function we have is GetPageColorSpaces.

This will return a CSV based string showing all the colorspaces used in the document for images.  If the string contains anything other than DeviceGray then there is a very good chance that colours are used in the document.

This may not pick up coloured objects in the content stream but most PDF's have some type of image or logo.

Andrew.
Back to Top
Doc-ItMan View Drop Down
Beginner
Beginner


Joined: 15 Nov 11
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Doc-ItMan Quote  Post ReplyReply Direct Link To This Post Posted: 27 Jul 12 at 7:01AM
I could not find that method in the QuickPDF Library v8.12.
 
Cheers Howard.
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 27 Jul 12 at 8:09AM
This is a relatively new function and is available in 8.15 / 8.16.  QPL  8.16 is a free upgrade to all registered 8.xx users and contains many fixes and improvements over 8.11 and 8.12.


Andrew.


Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 27 Jul 12 at 1:47PM
Hi!

There's no need to use ColourSpaces if you want to create coloured pdf-documents.
There could be DeviceRGB but the content is absolutely b/w... and there could be no ColourSpaces and the content are coloured images.
It's not a save method.
There are many printing services out there and the customers have to pay more for coloured printouts than for b/w. I've few customers using my solution i've described above.

Cheers, Ingo



Edited by Ingo - 27 Jul 12 at 1:48PM
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 02 Aug 12 at 11:40AM
Currently, the only 99.9% correct way of detecting colour in a PDF would be to render the page to a BMP file and then checking each and every pixel - basically following Ingo's method.

Some commercial design and printing customers need to know about the various plates and colorspaces used by a PDF and that is where GetPageColorSpaces comes in handy and is why I mentioned it as the answer hopefully may be useful for some people reading this.

Andrew.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store