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 - Method GetPageColorSpaces() not working?
  FAQ FAQ  Forum Search   Register Register  Login Login

Method GetPageColorSpaces() not working?

 Post Reply Post Reply
Author
Message
martin.weigl View Drop Down
Team Player
Team Player
Avatar

Joined: 23 Feb 16
Location: Upper Austria
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote martin.weigl Quote  Post ReplyReply Direct Link To This Post Topic: Method GetPageColorSpaces() not working?
    Posted: 21 Apr 16 at 1:43PM
Hello all,
on my search for a way to check, if RGB images are contained in an existing PDF file i found the method GetPageColorSpaces(). Supposing that this was exactly what I was looking for, i tried to iterate through the pages of the PDF file and call the method. No idea why, but it always returned an empty string.
Did I get the main purpose of this method wrong or do I need anything else to retrieve color space information (additional libraries, etc.)?
 
Regards,
Martin
 
My code looks something like this:
 
bool rgbFound = false;
for (int page = 1; page <= this.Library.PageCount(); page++)
{
    this.Library.SelectPage(page);
    string colorSpaces = this.Library.GetPageColorSpaces(0); // colorSpaces is always ""
    if (colorSpaces.ToLower().Contains("rgb"))
    {
        rgbFound = true;
        break;
    }
}
if (rgbFound)
{
    ...
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: 21 Apr 16 at 9:18PM
Hi Martin,

GetPageColorSpaces will collect the device-tags if there are any.
It's not a must to have devicetags for coloured pages.
You can have cmyk-colours without a /DeviceCMY inside and you can have rgb-colours without a /DeviceRGB. Better: You can have a b/w-page with a /DeviceRGB inside.
Here a piece of code with notepad out of a pdf of mine:
<<
/Filter /FlateDecode
/Height 28
/Length 206
/BitsPerComponent 1
/Width 688
/ColorSpace [ /Indexed /DeviceRGB 1 (‡¦›Ù ·) ]
/Subtype /Image
/Type /XObject

You can see /BitsPerComponent 1
... and this mean b/w-page
You can see /DeviceRGB
... but it's from a b/w-page.

Searching for a sample for you i've to check many pdfs 'cause often the device-tags were missing.

Cheers,
Ingo

Back to Top
martin.weigl View Drop Down
Team Player
Team Player
Avatar

Joined: 23 Feb 16
Location: Upper Austria
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote martin.weigl Quote  Post ReplyReply Direct Link To This Post Posted: 22 Apr 16 at 11:30AM
Hi Ingo,

thx. Now I have an idea, why GetPageColorSpaces() doesn't return anything:
no device tags in the PDFs.

Thx,
martin
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: 22 Apr 16 at 10:13PM
Yes... but coloured elements (rgb or cmyk) can be inside without a tag :(
That's pdf ... or that what somebody doing with it ;-)

Cheers,
Ingo

Back to Top
martin.weigl View Drop Down
Team Player
Team Player
Avatar

Joined: 23 Feb 16
Location: Upper Austria
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote martin.weigl Quote  Post ReplyReply Direct Link To This Post Posted: 25 Apr 16 at 1:13PM
Hi Ingo,

thx for your help!

Regards,
Martin
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