Print Page | Close Window

Get Colors in PDF

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3654
Printed Date: 06 May 24 at 8:45AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Get Colors in PDF
Posted By: Cefeg
Subject: Get Colors in PDF
Date Posted: 27 Dec 18 at 5:14AM
Does anyone have sample code or methodology to get the number of colors in a PDF?  
I am using C# with QuickPDF DLL v16.



Replies:
Posted By: Ingo
Date Posted: 27 Dec 18 at 12:19PM
Hi Cefeg,

you can analyze with QuickPDF how the color settings are set (the device tags with b/w, cmyk or rgb) or with GetPageColorSpaces:
https://www.debenu.com/docs/pdf_library_reference/GetPageColorSpaces.php
But you won't be able using QuickPDF to determine the real used colors in a pdf (the naked pages and embedded images). If you want this you should convert the pdf into an image and then trying the "bitmap" to get the color pixel by pixel.
 


-------------
Cheers,
Ingo



Posted By: Cefeg
Date Posted: 28 Dec 18 at 12:15AM
Thanks so much, Ingo.  I will give the two methods a try.  I need only to determine if the document is b&w or color.  Ideally also to determine if a b&w document is bitonal or grayscale. 


Posted By: Ingo
Date Posted: 28 Dec 18 at 11:51AM
Hi,

instead these tags regarding color types isn't a save methode to determine what's inside: Internally the pdf-structure offers the device-flags like
- for example - DeviceRGB, DeviceGray oder DeviceCMYK which
points to the used colours in the document. Better: It could
point 'cause it's not a must to use device-flags in the pdf-
document. It's possible to have coloured pages in a document
with DeviceGray and it's possible to have coloured and b/w-pages
in a document without any device-flag and it's possible to
have only b/w-pages in a document with DeviceCMYK and so on...
So the device-flags are only indicators for the used colour-
models in a document but not a save method to determine
coloured pages.



-------------
Cheers,
Ingo



Posted By: Ingo
Date Posted: 28 Dec 18 at 11:53AM
perhaps you can do something similar.
Here's something from my blog...
http://pdfcomments.blogspot.com/2012/12/analyze-pdf-documents-for-coloured-pages.html



-------------
Cheers,
Ingo




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk