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!
Detecting Colour in a PDF |
Post Reply |
Author | |
Doc-ItMan
Beginner Joined: 15 Nov 11 Status: Offline Points: 5 |
Post Options
Thanks(0)
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?
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
Doc-ItMan
Beginner Joined: 15 Nov 11 Status: Offline Points: 5 |
Post Options
Thanks(0)
|
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.
|
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
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.
|
|
Doc-ItMan
Beginner Joined: 15 Nov 11 Status: Offline Points: 5 |
Post Options
Thanks(0)
|
I could not find that method in the QuickPDF Library v8.12.
Cheers Howard.
|
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
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.
It can be downloaded from http://www.quickpdflibrary.com/products/quickpdf/updates.php Andrew. |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
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.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store