Print Page | Close Window

Method GetPageColorSpaces() not working?

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=3314
Printed Date: 03 May 24 at 4:41AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Method GetPageColorSpaces() not working?
Posted By: martin.weigl
Subject: Method GetPageColorSpaces() not working?
Date 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)
{
    ...



Replies:
Posted By: Ingo
Date 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



Posted By: martin.weigl
Date 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


Posted By: Ingo
Date 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



Posted By: martin.weigl
Date Posted: 25 Apr 16 at 1:13PM
Hi Ingo,

thx for your help!

Regards,
Martin



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