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!
How to get color Info from PDF |
Post Reply |
Author | |
Harier
Beginner Joined: 08 Dec 05 Location: Afghanistan Status: Offline Points: 6 |
Post Options
Thanks(0)
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
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
Harier
Beginner Joined: 08 Dec 05 Location: Afghanistan Status: Offline Points: 6 |
Post Options
Thanks(0)
|
I can't understand how do you read all into a string?? |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi!
I haven't access to my sources now. I'll post some code here this evening. |
|
Cheers,
Ingo |
|
chicks
Debenu Quick PDF Library Expert Joined: 29 Oct 05 Location: United States Status: Offline Points: 251 |
Post Options
Thanks(0)
|
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 |
|
Michel_K17
Newbie www.exp-systems.com Joined: 25 Jan 03 Status: Offline Points: 297 |
Post Options
Thanks(0)
|
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 |
|
chicks
Debenu Quick PDF Library Expert Joined: 29 Oct 05 Location: United States Status: Offline Points: 251 |
Post Options
Thanks(0)
|
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 |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
chicks
Debenu Quick PDF Library Expert Joined: 29 Oct 05 Location: United States Status: Offline Points: 251 |
Post Options
Thanks(0)
|
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 |
|
Harier
Beginner Joined: 08 Dec 05 Location: Afghanistan Status: Offline Points: 6 |
Post Options
Thanks(0)
|
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 |
|
chicks
Debenu Quick PDF Library Expert Joined: 29 Oct 05 Location: United States Status: Offline Points: 251 |
Post Options
Thanks(0)
|
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? |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store