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 - How to get color Info from PDF
  FAQ FAQ  Forum Search   Register Register  Login Login

How to get color Info from PDF

 Post Reply Post Reply
Author
Message
Harier View Drop Down
Beginner
Beginner


Joined: 08 Dec 05
Location: Afghanistan
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Harier Quote  Post ReplyReply Direct Link To This Post Topic: How to get color Info from PDF
    Posted: 16 Dec 05 at 2:27AM

Hi

I'm can't find any color info function in library?

May be there some other tricks?

I'm need the info about additional colors (Pantone or other nonstandart) found in PDF file.

(same as displayed in Print_production->Output_preview command in Acro7)

Thanks

 

 

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: 16 Dec 05 at 3:19AM
Hi!
I had the same problems i think...
I wanna know if rgb, cmyk or grey was used.
I do LoadFromFile, Encrypt and read all into a string. In this string i search for "RGB", "CMYK" and "GREY".
If you wanna make some experiences have a look in these string content... you'll see many interesting things for your own functions ;-)
Cheers,
Ingo

Back to Top
Harier View Drop Down
Beginner
Beginner


Joined: 08 Dec 05
Location: Afghanistan
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Harier Quote  Post ReplyReply Direct Link To This Post Posted: 16 Dec 05 at 4:32AM

I can't understand how do you read all into a string??

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: 16 Dec 05 at 5:30AM
Hi!
I haven't access to my sources now. I'll post some code here this evening.
Cheers,
Ingo

Back to Top
chicks View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert


Joined: 29 Oct 05
Location: United States
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote chicks Quote  Post ReplyReply Direct Link To This Post Posted: 16 Dec 05 at 12:33PM
Harier,

I wrote a color extraction library that extracts all CMYK
spot and process colors from a PDF.

It doesn't use QuickPDF, just opens the PDF and parses all objects looking for colorspaces and separations. It uses the open-source zlib.dll to uncompress any streams it comes across (only handles Flate encoding, so I use pdftk to decompress any PDFs that use other encodings first). It then parses the decompressed streams using regex for color definition patterns, such as:

0 0 0 0 K
0.3 0 0.4 1 k

etc.

It really isn't too difficult to do it yourself if you download the PDF spec and have a bit of regex knowledge.

My lib is for a prepress color separation tool I'm building for a printing company, so it only deals with CMYK values, not RGB. Also, it has a built-in Pantone to CMYK table, which you can download from Pantone.com.

I can't share my code, but (hint, hint) you can get a REALLY good introduction to PDF parsing with this code:

http://www.codeproject.com/useritems/pdfview.asp
Back to Top
Michel_K17 View Drop Down
Newbie
Newbie
Avatar
www.exp-systems.com

Joined: 25 Jan 03
Status: Offline
Points: 297
Post Options Post Options   Thanks (0) Thanks(0)   Quote Michel_K17 Quote  Post ReplyReply Direct Link To This Post Posted: 16 Dec 05 at 2:40PM
Hi Chicks!

   Thanks for the "hint"

   Personnally, I had been using a PDF Editor called "NitroPDF Pro" to be able to look at a picture and get info about the colorspace. That program is not bad, but has a quirky user interface and for being a little bit slow. I give it a 3.5 stars out of 5. It costs $99 and is available at www.nitropdf.com

Back to Top
chicks View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert


Joined: 29 Oct 05
Location: United States
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote chicks Quote  Post ReplyReply Direct Link To This Post Posted: 16 Dec 05 at 3:16PM
Yep, I'm very familiar with NitroPDF. They use the Zeon PDF lib. I installed their beta the day it came out, but their forms interface was VERY slow at that time. Probably better now.

BTW, they don't publish an API, but it's very simple to get the interface and write to it
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: 16 Dec 05 at 5:55PM
Harier,

here's my code for extracting the complete file into a string (Delphi) ...

. . .
   textkomplett := '';
   fs := TFileStream.Create(Edit1.Text,fmOpenRead+fmShareDenyWrite);
   try
     SetLength(textkomplett,fs.Size);
     fs.Read(PChar(textkomplett)^,fs.Size);
   finally
     fs.Free;
   end;
. . .
Later you can use things like this:
. . .
       If Pos('/Device', textkomplett) > 0 Then
          begin
             fschema.Text := System.Copy(textkomplett, Pos('/Device', textkomplett) + 7, 4);
             fschema.Text := Trim(fschema.text);
          end
        else
          fschema.Text := 'Nothing';
. . .
Behind "Device" there's the colour model...

Good luck!
Ingo

Cheers,
Ingo

Back to Top
chicks View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert


Joined: 29 Oct 05
Location: United States
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote chicks Quote  Post ReplyReply Direct Link To This Post Posted: 16 Dec 05 at 11:26PM
Harier,

I put together a commandline .exe using my lib. It only does DeviceCMYK process and spot separation colors, but if it extracts what you want, maybe I can create a DLL for you. It will ignore any RGB or any colors in images. Sorry, can't provide source code.

http://www.geocities.com/sea_sbs/files/pdfcolors.zip

Edited by chicks
Back to Top
Harier View Drop Down
Beginner
Beginner


Joined: 08 Dec 05
Location: Afghanistan
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Harier Quote  Post ReplyReply Direct Link To This Post Posted: 20 Dec 05 at 3:49AM

Thank You Chicks

I'm trying the pdfcolors it works. But I'm need in for some more simple task. To do the list of nonstandart additional or "spot" colors for information only. So I'm no need in percent or objects info with some colors.

After looking on PDF file content (through text viewer) I'm discover that my info is after word "Separation". But in some files this info is omit(or encrypted) So some research is needed. 

Your program is very interesting because it can determine what real colors are in file. But sometime it describe color as (unknown) what it mean?

Thank's 

Back to Top
chicks View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert


Joined: 29 Oct 05
Location: United States
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote chicks Quote  Post ReplyReply Direct Link To This Post Posted: 20 Dec 05 at 12:37PM
Harier,

The program is meant primarily to discover a set of predefined colors and Pantone colors, so has internal tables with cmyk values for about 800 process colors, and all 1089 Pantone colors.

Any cymk values not matching the internal tables return as (unknown), which simply means no "friendly" name for the cmyk values is known to the program.

I have thought about moving the color tables to an xml file or SQLite database so that they can be maintained without coding and recompiling. Do you have any interest in such an app?
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