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 - Get Colors in PDF
  FAQ FAQ  Forum Search   Register Register  Login Login

Get Colors in PDF

 Post Reply Post Reply
Author
Message
Cefeg View Drop Down
Beginner
Beginner
Avatar

Joined: 16 Feb 16
Location: California
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cefeg Quote  Post ReplyReply Direct Link To This Post Topic: Get Colors in PDF
    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.
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 (1) Thanks(1)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Cefeg View Drop Down
Beginner
Beginner
Avatar

Joined: 16 Feb 16
Location: California
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cefeg Quote  Post ReplyReply Direct Link To This Post 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. 
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: 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

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 (1) Thanks(1)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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

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