xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Abel Braaksma <abel.onl...@xs4all.nl>
Subject Re: AW: Generate Black and White PDF's
Date Mon, 23 Apr 2007 12:57:07 GMT
Matthias Müller wrote:
> hi again ;-)
>
> Ok, maybe i didn't expressed my needs correctly.
> At the moment i generate PDF files using FOP. This PDF files are colored.
> What i need now is a way to tell my FOP Serializer to make the same 
> output in gray scales, WITHOUT changing the color properties of each 
> colored block.
> Got Me ;-)

So, basically, you want the same as what happens when you print anything 
that has colored to a gray-scale printer, right? What you need is two 
FOP files, of course, and you XSLT process (I assume you use XSLT for 
getting your FOP files, but I can't tell for sure of course) is best 
split in two phases (or, if you can use the exslt:node-set extension in 
xslt 1.0, or if you use xslt 2.0, you can use temporary trees), where 
the first phase is your colored transform and the second phase 
calculates the gray scales from this (using, of course, an modified 
identity transformation that only changes the attributes with color 
information).

Google a bit around and you will find plenty of algorithms for getting 
from color to gray scale.

An idea to get the all properties that have color information:

<xsl:template match="@*[starts-with(., 'rgb(') or starts-with(., '#') or 
starts-with('cmyk(')]" >
   <xsl:attribute name="{name()}">
      <xsl:call-template name="color-to-bw">
         <xsl:with-param name="color-value" select="." />
      </xsl:call-template>
    </xsl:attribute>
</xsl:template>


Good luck coding!

-- Abel Braaksma

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


Mime
View raw message