You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Timo Haberkern <th...@emedia-office.de> on 2003/11/21 09:44:05 UTC

CMYK again

Hi all,

i read the last threads about cmyk for FOP, but it seems that there was 
no solution for the problems.

If i read all the messages completely there is the following status:

1.) FOP (or XSL:FO) doesn't support CMYK directly

2.) CMYK JPEGs shouldn't be a problem in FOP through JAI support

3.)  Ben Galbraith suggested a solution replacing the RGB commands rg/RG 
with CMYK k/K for every PDF object and mentioned a self-written tool for 
doing that task.

4.) Someone mentioned to do this replacement in the output method in 
PDFDocument.java, but it seems nobody has tried it so far.


My problem is that i will need CMYK support in the near future and i'm 
not the "big" coder, so i think i have no chance to do "hacking" FOP to 
my needs. But i think there are more people like me who want to create 
CMYK documents with FOP. Maybe it is possible to create a wiki for this 
topic, so we get a complete way how to solve this problem?

Ben: How about release your mentioned tool as open source?

Any ideas about that?


A question to the FOP coding gurus: What would be the "correct"/best way 
to implement an extension to FOP that can generate a CMYK document?

rgds
Timo


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: CMYK again

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Timo Haberkern wrote:
> A question to the FOP coding gurus: What would be the "correct"/best way 
> to implement an extension to FOP that can generate a CMYK document?

Check whether iText or any other of the handful of PDF libraries
on sourceforge can help you with this problem.

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: CMYK again

Posted by Clay Leeds <cl...@medata.com>.
Timo Haberkern wrote:
> A question to the FOP coding gurus: What would be the "correct"/best way 
> to implement an extension to FOP that can generate a CMYK document?
> 
> rgds
> Timo

Here're a couple of ideas of where to look:

EXSLFO Project:
http://exslfo.sourceforge.net/

EXSLFO Project Home:
https://sourceforge.net/projects/exslfo/

which appears to be an extension of:
http://exslt.org/

Good luck!

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: CMYK again

Posted by Ben Galbraith <bg...@amirsys.com>.
Timo Haberkern wrote:
> Ok, i understood that. But i think the color values must be changed too 
> or i'm wrong. I think there must be a conversion from rgb to cmyk values?!?

Right.  I haven't created code that performs intelligent RGB -> CMYK 
conversion; rather, I replace specific RGB values with specific CMYK 
values based on decisions we've made ahead of time.

> Sorry don't understand that. For what is this task?

A PDF file is a series of "objects", each of which contains instructions 
for how it should be rendered.  At the end of the PDF is a reference 
table indicating the byte offset of each object.

To save space, each object can be compressed using a few different 
methods.  To modify the object's contents, the object must be 
decompressed.  Because decompressing an object changes its size, the 
reference table must be updated when the object is decompressed.  A tool 
such as Multivalent can take care of this for you (although as I've said 
previously, I had problems with it when I tried it; many others have not 
had problems).

Once the objects have been decompressed, you can perform a search and 
replace operation -- BUT, because the replace operation will likely 
change the size of the objects, you should use a tool that rewrites the 
reference table.

The text you need to replace has this general syntax:

	[red value] [green value] [blue value]  rg

or

	[red value] [green value] [blue value]  RG

You'll need to replace it with:

	[cyan] [magenta] [yellow] [black] k

and:

	[cyan] [magenta] [yellow] [black] K

respectively.  Note that the color values are decimals, not integers. 
So, 255 = 1.0, 127 = 0.5, etc.

Note, that as others have said, going to all this trouble only makes 
sense if you really need your code to do this.  Other tools exist that 
can automate this process for you via a GUI, etc.

So, check if Multivalent can do this.  If it can, great.  If not, check 
for other libs -- I'm told several exist.  If you decide to get your own 
hands dirty, while I do not have permission to give you the code, I can 
offer a steady supply of advice.  I've had a few requests for my lib, so 
I'll check again and see if I can get it released, since a PDF lib isn't 
neither innovative or proprietary.

Ben

> 
> 
> Timo
> 
> Also, the number on the second last line of the document should be replaced
> 
>> with the number of bytes written until the occurrence of the last 
>> 'endobj'
>> command.
>>
>>
>> There is a number of plug-ins, that can be used from within Adobe 
>> Reader to
>> convert the RGB colors of a PDF document into CMYK colors.
>> There is a tool named QuiteABoxOfTricks that can be found at
>> http://www.quite.com doing this.
>> I am sure it is possible to setup a batch processing solution as well, in
>> order to create a totally automated hack solution for this lack.
>> PitStop server is another solution.
>>
>>
>> Regards,
>> Dennis JD Myrén
>> Developer
>> Tel:      (+47) 98 00 11 92
>> Mail:   dennis@oslokb.no
>> Web:   www.oslokb.no
>>
>> -----Original Message-----
>> From: Timo Haberkern [mailto:thaberkern@emedia-office.de] Sent: 21. 
>> november 2003 14:38
>> To: fop-user@xml.apache.org
>> Subject: Re: CMYK again
>>
>> Ben,
>>
>>  
>>
>>> The President of my employer is a lawyer.  Dunno if open-source will 
>>> happen anytime soon for that lib.  ;-)
>>>
>>> Have you checked if the open-source Multivalent lib supports this 
>>> type of operation?  I'll try and take a gander too, but you should 
>>> check and see.
>>>
>>>   
>>
>> I will check it next week.
>> Thanks for the tip.
>>
>> I think it should be possible to create cmyk pdf from FOP directly. So 
>> if you can't "open-source" your solution, maybe you can talk a little 
>> bit about how to do such a replacement, so that i can maybe hack 
>> something similar into FOP?
>>
>> Timo
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
>> For additional commands, e-mail: fop-user-help@xml.apache.org
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
>> For additional commands, e-mail: fop-user-help@xml.apache.org
>>
>>
>> .
>>
>>  
>>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: CMYK again

Posted by Timo Haberkern <th...@emedia-office.de>.

>Then, what you will need is a regular expression, that finds any 'RG' or
>'rg' color commands, to replace them with 'K' or 'k', respectively.
>Of course, the expression needs to be smart enough only to replace
>occurrences of 'RG' or 'rg' that is actually color commands.
>Searching for occurrences of three space separated numbers followed by space
>and then 'RG' or 'rg' is a hack, that might (but only might) be good enough.
>  
>
Ok, i understood that. But i think the color values must be changed too 
or i'm wrong. I think there must be a conversion from rgb to cmyk values?!?

>Then, the XRef Table needs to be rebuilt.
>This tasks should be possible to do with another regular expression,
>That searches for any occurrences of '[anInteger] [anotherInteger] obj' and
>adds the byte offset positions of these matches into a new XRef Table, that
>in the end should replace the existing XRef Table.
>  
>
Sorry don't understand that. For what is this task?


Timo

Also, the number on the second last line of the document should be replaced

>with the number of bytes written until the occurrence of the last 'endobj'
>command.
>
>
>There is a number of plug-ins, that can be used from within Adobe Reader to
>convert the RGB colors of a PDF document into CMYK colors.
>There is a tool named QuiteABoxOfTricks that can be found at
>http://www.quite.com doing this.
>I am sure it is possible to setup a batch processing solution as well, in
>order to create a totally automated hack solution for this lack.
>PitStop server is another solution.
>
>
>Regards,
>Dennis JD Myrén
>Developer
>Tel:      (+47) 98 00 11 92
>Mail:   dennis@oslokb.no
>Web:   www.oslokb.no
>
>-----Original Message-----
>From: Timo Haberkern [mailto:thaberkern@emedia-office.de] 
>Sent: 21. november 2003 14:38
>To: fop-user@xml.apache.org
>Subject: Re: CMYK again
>
>Ben,
>
>  
>
>>The President of my employer is a lawyer.  Dunno if open-source will 
>>happen anytime soon for that lib.  ;-)
>>
>>Have you checked if the open-source Multivalent lib supports this type 
>>of operation?  I'll try and take a gander too, but you should check 
>>and see.
>>
>>    
>>
>I will check it next week.
>Thanks for the tip.
>
>I think it should be possible to create cmyk pdf from FOP directly. So 
>if you can't "open-source" your solution, maybe you can talk a little 
>bit about how to do such a replacement, so that i can maybe hack 
>something similar into FOP?
>
>Timo
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
>For additional commands, e-mail: fop-user-help@xml.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
>For additional commands, e-mail: fop-user-help@xml.apache.org
>
>
>.
>
>  
>

-- 
Grüsse

Timo Haberkern

EMEDIA OFFICE GmbH
Wingertstr. 4
74850 Schefflenz-Kl.

http://www.emedia-office.com
thaberkern@emedia-office.de

Tel.: 06293/921121
Fax:  06293/921129



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: CMYK again

Posted by Dennis Myrén <de...@oslokb.no>.
Well, in FOP 0.20.5 it is possible to generate uncompressed PDF documents.
Although this may increase the file size, sometimes dramatically, it makes
the RGB->CMYK replace operation much simpler,
Because the PDF document wont need to be decompressed before performing
those tasks.
Then, what you will need is a regular expression, that finds any 'RG' or
'rg' color commands, to replace them with 'K' or 'k', respectively.
Of course, the expression needs to be smart enough only to replace
occurrences of 'RG' or 'rg' that is actually color commands.
Searching for occurrences of three space separated numbers followed by space
and then 'RG' or 'rg' is a hack, that might (but only might) be good enough.

Then, the XRef Table needs to be rebuilt.
This tasks should be possible to do with another regular expression,
That searches for any occurrences of '[anInteger] [anotherInteger] obj' and
adds the byte offset positions of these matches into a new XRef Table, that
in the end should replace the existing XRef Table.

Also, the number on the second last line of the document should be replaced
with the number of bytes written until the occurrence of the last 'endobj'
command.


There is a number of plug-ins, that can be used from within Adobe Reader to
convert the RGB colors of a PDF document into CMYK colors.
There is a tool named QuiteABoxOfTricks that can be found at
http://www.quite.com doing this.
I am sure it is possible to setup a batch processing solution as well, in
order to create a totally automated hack solution for this lack.
PitStop server is another solution.


Regards,
Dennis JD Myrén
Developer
Tel:      (+47) 98 00 11 92
Mail:   dennis@oslokb.no
Web:   www.oslokb.no

-----Original Message-----
From: Timo Haberkern [mailto:thaberkern@emedia-office.de] 
Sent: 21. november 2003 14:38
To: fop-user@xml.apache.org
Subject: Re: CMYK again

Ben,

> The President of my employer is a lawyer.  Dunno if open-source will 
> happen anytime soon for that lib.  ;-)
>
> Have you checked if the open-source Multivalent lib supports this type 
> of operation?  I'll try and take a gander too, but you should check 
> and see.
>
I will check it next week.
Thanks for the tip.

I think it should be possible to create cmyk pdf from FOP directly. So 
if you can't "open-source" your solution, maybe you can talk a little 
bit about how to do such a replacement, so that i can maybe hack 
something similar into FOP?

Timo


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: CMYK again

Posted by Timo Haberkern <th...@emedia-office.de>.
Ben,

> The President of my employer is a lawyer.  Dunno if open-source will 
> happen anytime soon for that lib.  ;-)
>
> Have you checked if the open-source Multivalent lib supports this type 
> of operation?  I'll try and take a gander too, but you should check 
> and see.
>
I will check it next week.
Thanks for the tip.

I think it should be possible to create cmyk pdf from FOP directly. So 
if you can't "open-source" your solution, maybe you can talk a little 
bit about how to do such a replacement, so that i can maybe hack 
something similar into FOP?

Timo


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: CMYK again

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Ben Galbraith wrote:
> I don't know if the XSL-FO color space support supports CMYK or not. 

XSLFO only supports sRGB (gamma corrected!) and ICC colors. Of course,
the spec doesn'n mention how the colors in the output should look like.

J.Pietschmann




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: CMYK again

Posted by Ben Galbraith <bg...@amirsys.com>.
Timo,

Timo Haberkern wrote:
> 1.) FOP (or XSL:FO) doesn't support CMYK directly

I don't know if the XSL-FO color space support supports CMYK or not. 
Others may comment on this who have read the spec more than I.

> 2.) CMYK JPEGs shouldn't be a problem in FOP through JAI support

I use CMYK JPEGs in FOP all the time.

> Ben: How about release your mentioned tool as open source?

The President of my employer is a lawyer.  Dunno if open-source will 
happen anytime soon for that lib.  ;-)

Have you checked if the open-source Multivalent lib supports this type 
of operation?  I'll try and take a gander too, but you should check and see.

Ben

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org