Determine Color usage in PDF

Example requests & Code samples for GdPicture Toolkits.
Post Reply
VTDev
Posts: 1
Joined: Wed May 04, 2016 5:10 pm

Determine Color usage in PDF

Post by VTDev » Wed May 04, 2016 5:24 pm

Hi,
I am looking for the best way to determine if a text based or mixed text/image PDF page contains only black & white text or contains color. I don't see a function in GDPicturePDF to return that info.
Am I correct that I should render the page to an image and then use the ColorDetection method on the resulting image?
If so, should I render 1st at a very low dpi, and then re-render at the higher dpi once I know what PixelFormat I want the page rendered?
Or should I render 1st at the normal (say 200) dpi, perform the detection, then convert to a more compact format once the Intent (color/black & white) is known?

Ultimate goal is to get each page of the PDF into a TIF raster, appropriately either at 1bpp CCITTG4 or 24bpp JPEG in TIF.

Thanks!

Cedric
Posts: 269
Joined: Sun Sep 02, 2012 7:30 pm

Re: Determine Color usage in PDF

Post by Cedric » Fri May 06, 2016 11:34 am

Hello,

It is very easy and you do not need to do multiple rasterizations at different resolution or anything, here is a complete working example demonstrating the exact same goal you're trying to achieve:
https://www.gdpicture.com/guides/gdpicture/web ... anism.html

Cheers!

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest