forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ross Gardler <rgard...@apache.org>
Subject Re: Pdf output poorly formated (was RE: Bookmarklets: ...)
Date Wed, 20 Dec 2006 10:37:55 GMT
Paterline, David L. wrote:
> Thanks again for the response that pointed me in the right direction. Part
> of my formatting problems were corrected. Now, I have some more questions
> that might be more about how Forrest generates PDF from XML. For instance:
> 
> - The text in my table header cells (<th>) is either printed with white
> foreground color, or is absent in the PDF. If I change these entries to be
> <td>, the text appears in the PDF. What control do I have over how this
> appears? What controls this? How do I correct this?

The XSL FO that is used to generate the PDF is created by webapp / skins 
/ common / xslt / fo / document-to-fo.xsl. Looking in this file I see 
there is a template to handle the <th> tags:

<xsl:template match="th">
       <xsl:variable name="border-color" 
select="//skinconfig/colors/color[@name = 'table']/@value"/>
       <xsl:variable name="background-color" select="$border-color"/>
       <fo:table-cell
         padding-before="4pt"
         padding-after="4pt"
         padding-start="4pt"
         padding-end="4pt"
         color="#FFFFFF"
         background-color="{$background-color}"
         border="1pt solid {$border-color}">
         <xsl:attribute name="number-columns-spanned">
           <xsl:value-of select="@colspan"/>
         </xsl:attribute>
         <xsl:attribute name="number-rows-spanned">
           <xsl:value-of select="@rowspan"/>
         </xsl:attribute>
         <fo:block
           text-align="center">
           <xsl:apply-templates/>
         </fo:block>
       </fo:table-cell>
   </xsl:template>

Note the background-color is set to whatever you have the table 
border-color set to and the foreground is set to white.

So my guess is you have your border colour set to white, hence the 
content is not visible.

This is a silly way to do things, the above XSL needs to be changed to 
allow the foreground and background of table headers to be set in 
skinconf. Please be sure to open an issue ad provide a patch for this 
(if you don't know how then start a new thread here and someone will 
guide you through it).


> - My HTML page contains four tables. I would like to have each table start
> on a new page in the PDF. Is this possible? What controls this, and how do I
> implement page breaks?

http://forrest.apache.org/docs_0_70/faq.html#pageBreaks

> - In my HTML page, I use an "email" image (graphic of an envelope) in a
> "mailto:" link. These images appear in the PDF and take up a lot of room and
> cause the cell contents to wrap, etc. Can I suppress the appearance of these
> images in the PDF? How?

Not at present, you could add a filter to skinconf.xml to tell Forrest 
which images to ignore in a PDF document. This would be processed in the 
template   <xsl:template match="figure|img"> in the above XSL.

> I know I'll have more questions as I dig deeper, so I hope you'll bear with
> me as I try to understand which technology I need to work with, and how I
> modify these behaviors within Forrest.

Keep them coming, but please:

- one question per mail thread
- appropriate subject lines

This makes the archives much easier for people to use and therefore 
increases the chances that someone coming after you with the same 
problem will find the answer without having to take up more of our time.

Ross

Mime
View raw message