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 "Nguyen, Thang" <tn...@fcg.com> on 2006/06/08 06:02:42 UTC
Auto-size header to fit with content ?
hi,
I use belows to define header/body size.
<fo:region-before region-name="header-first" extent="50pt" />
<fo:region-body margin-top="50pt" margin-bottom="50pt" />
my problem is the content of header might be greater than the size I
defined and part of content does not show up in the header of document.
Could someone show me how to make header&body autoresize themselves to
fit the content of the header ?
thanks,
Thang.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
This email may contain material that is confidential, privileged and/or attorney work product for the sole use of the intended recipient. Any review, reliance or distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Re: Suppress RTF
Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 09.06.2006 00:08:52 Andreas L Delmelle wrote:
> On Jun 8, 2006, at 16:40, Will Peterson wrote:
>
> Hi Will,
>
> > Quick question,
> >
> > I am going to customize FOP to suppress the RTF gif image exception
> > when rendering documents. (i.e.
> > org.apache.fop.render.rtf.rtflib.rtfdoc.RtfExternalGraphic
> > $ExternalGraphicException: The tag <fo:external-graphic> does not
> > support gif - image type.)
> >
> > Would it be recommended to recompile the whole fop.jar, or should I
> > just customize the one class (RtfExternalGraphic) and include it on
> > the class path. Any suggestions here.
>
> In theory, the following should work:
>
> 1° download the FOP sources, modify that one class, then 'ant compile'
> 2° in the build directory, look for the .class file in question
> 3° replace the file in the fop.jar you already have with the freshly
> compiled one
>
> Then again, I'm wondering why I would do this... but it might be
> handy if you need to minimize the hassle of maintaining a customized
> FOP version :/
> As for myself, I'd probably just modify the source file, run 'ant
> package', and replace the whole fop.jar.
>
> If you have any interest in extending your customization to be a
> configurable RTFRenderer-specific option, patches are welcome ;)
I think that would be the best approach. That the RTF output generates
some text in the output file if it encounters a problem loading an image
is a legacy from JFOR times. In our other output formats we send the
error message to the log and continue with no image. Not the best
approach either, depending on the requirements. So, for the moment it
may be better to simply change the code to issue a warning on the log
and ignore the image to match the behaviour of the other output formats.
For the long term, the following will be the right way to go:
http://wiki.apache.org/xmlgraphics-fop/ProcessingFeedback
Jeremias Maerki
Re: Suppress RTF
Posted by Andreas L Delmelle <a_...@pandora.be>.
On Jun 9, 2006, at 00:08, Andreas L Delmelle wrote:
> On Jun 8, 2006, at 16:40, Will Peterson wrote:
>
>>
>> Would it be recommended to recompile the whole fop.jar, or should
>> I just customize the one class (RtfExternalGraphic) and include it
>> on the class path. Any suggestions here.
>
> In theory, the following should work:
Just realized that this may lead to very nasty runtime errors if some
fop-dev decides on altering classes that one class depends on... So,
yeah, would work in theory, provided that the related codebase isn't
out-of-sync with your own version...
In short: if I were you, I'd go for the complete rebuild. That's the
least likely to cause you any headaches.
Later,
Andreas
Re: Suppress RTF
Posted by Andreas L Delmelle <a_...@pandora.be>.
On Jun 8, 2006, at 16:40, Will Peterson wrote:
Hi Will,
> Quick question,
>
> I am going to customize FOP to suppress the RTF gif image exception
> when rendering documents. (i.e.
> org.apache.fop.render.rtf.rtflib.rtfdoc.RtfExternalGraphic
> $ExternalGraphicException: The tag <fo:external-graphic> does not
> support gif - image type.)
>
> Would it be recommended to recompile the whole fop.jar, or should I
> just customize the one class (RtfExternalGraphic) and include it on
> the class path. Any suggestions here.
In theory, the following should work:
1° download the FOP sources, modify that one class, then 'ant compile'
2° in the build directory, look for the .class file in question
3° replace the file in the fop.jar you already have with the freshly
compiled one
Then again, I'm wondering why I would do this... but it might be
handy if you need to minimize the hassle of maintaining a customized
FOP version :/
As for myself, I'd probably just modify the source file, run 'ant
package', and replace the whole fop.jar.
If you have any interest in extending your customization to be a
configurable RTFRenderer-specific option, patches are welcome ;)
Cheers,
Andreas
Suppress RTF
Posted by Will Peterson <wp...@novell.com>.
Quick question,
I am going to customize FOP to suppress the RTF gif image exception
when rendering documents. (i.e.
org.apache.fop.render.rtf.rtflib.rtfdoc.RtfExternalGraphic$ExternalGraphicException:
The tag <fo:external-graphic> does not support gif - image type.)
Would it be recommended to recompile the whole fop.jar, or should I
just customize the one class (RtfExternalGraphic) and include it on the
class path. Any suggestions here.
Thanks,
-Will
Re: Auto-size header to fit with content ?
Posted by Web Maestro Clay <th...@gmail.com>.
You can also set the HEADER/FOOTER (fo:region-before/fo:region-after)
programmatically, determining the amount of space required by
counting lines of text (if you're lucky enough to have it divided
into lines!) or characters. In the first section, I specify variables
(minimum header height, line height, and unit of measure). The 2nd
section shows how the FOOTER extent is set based on the number of
lines in the TRAILER, and the 3rd shows the HEADER section is the
minimum height plus one line.
Hope this helps!
Web Maestro Clay
<!-- ======== -->
<!-- BEGIN - myxslfo_default.fo "Dynamic Header and Footer SIZE"
VARs -->
<!-- varUnitOfMeasure_DEFAULT | minimum height for bill -
default: cm -->
<xsl:variable name="varUnitOfMeasure_DEFAULT">cm</xsl:variable>
<!-- varHeaderMinHeight_DEFAULT | minimum height for bill -
default:5.15 (cm) -->
<xsl:variable name="varHeaderMinHeight_DEFAULT">5.15</xsl:variable>
<!-- varLineHeight_DEFAULT | line height for bill - default:.3
(cm) -->
<xsl:variable name="varLineHeight_DEFAULT">.3</xsl:variable>
<!-- varHeadingLineHeight_DEFAULT | Heading line height for
bill (includes "Continued on next page..." line) - default:1.25 (cm) -->
<xsl:variable name="varHeadingLineHeight_DEFAULT">1.25</xsl:variable>
<!-- END - myxslfo_default.fo "Dynamic Header and Footer SIZE"
VARs -->
<!-- ======== -->
<fo:region-after>
<xsl:attribute name="extent"><xsl:value-of select="number(count(/
doc/TRAILER/TRAILERLINE[.!=''])*$varLineHeight_DEFAULT+
$varHeadingLineHeight_DEFAULT)"/><xsl:value-of
select="$varUnitOfMeasure_DEFAULT"/></xsl:attribute>
</fo:region-after>
<fo:region-before>
<xsl:attribute name="extent"><xsl:value-of select="format-number
($varHeaderMinHeight_DEFAULT+$varLineHeight_DEFAULT,'#.00')"/
><xsl:value-of select="$varUnitOfMeasure_DEFAULT"/></xsl:attribute>
</fo:region-before>
On Jun 8, 2006, at 6:02 AM, Jeremias Maerki wrote:
> Unfortunately, that's not possible. XSL-FO requires that the extent
> of a
> side region (like region-before) must be specified absolutely.
> That's a
> necessity due to the layout process. Otherwise, this could cause
> endless
> loops due to circular adjustments.
>
> See:
> http://www.w3.org/TR/xsl11/#extent
>
> A work-around is to specify a rather large value for region-before and
> then investigate the size used up by its content by inspecting the
> area
> tree XML (-at on the command-line) and then adjusting the value in
> your
> stylesheet and finally running FOP once more with the effective value.
>
> On 08.06.2006 06:02:42 Nguyen, Thang wrote:
>> hi,
>>
>> I use belows to define header/body size.
>>
>> <fo:region-before region-name="header-first" extent="50pt" />
>> <fo:region-body margin-top="50pt" margin-bottom="50pt" />
>>
>> my problem is the content of header might be greater than the size I
>> defined and part of content does not show up in the header of
>> document.
>> Could someone show me how to make header&body autoresize
>> themselves to
>> fit the content of the header ?
>
>
> Jeremias Maerki
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
Web Maestro Clay
the.webmaestro@gmail.com
My religion is simple. My religion is kindness.
-- HH Dalai Lama of Tibet
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Auto-size header to fit with content ?
Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Unfortunately, that's not possible. XSL-FO requires that the extent of a
side region (like region-before) must be specified absolutely. That's a
necessity due to the layout process. Otherwise, this could cause endless
loops due to circular adjustments.
See:
http://www.w3.org/TR/xsl11/#extent
A work-around is to specify a rather large value for region-before and
then investigate the size used up by its content by inspecting the area
tree XML (-at on the command-line) and then adjusting the value in your
stylesheet and finally running FOP once more with the effective value.
On 08.06.2006 06:02:42 Nguyen, Thang wrote:
> hi,
>
> I use belows to define header/body size.
>
> <fo:region-before region-name="header-first" extent="50pt" />
> <fo:region-body margin-top="50pt" margin-bottom="50pt" />
>
> my problem is the content of header might be greater than the size I
> defined and part of content does not show up in the header of document.
> Could someone show me how to make header&body autoresize themselves to
> fit the content of the header ?
Jeremias Maerki
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org