You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Torsten Erler <er...@net-linx.de> on 2002/04/26 15:24:27 UTC

external-graphic size

Hi all

I've a problem with external graphics, which can be greater than the page
size of the xsl-template. The properties max-height and max-width doesn't
work (not implemented). The result is an infinite loop on rendering the
(correctly) generated "fo"-file with the AWTRenderer to display the result.
Is there a workaround for that or have I omit an important setting (possible
in xsl) for a parent object.

cu Torsten


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


RE: external-graphic size

Posted by Torsten Erler <er...@net-linx.de>.
ThanX fred

After many hours of work for scaling the picture right (with attention for
margins and static areas etc.), now I've accidental changed the layout
master set "extend" attributes of the regions: before and after as well as
the top/bottom margin unit of measures from "mm" to "px" for space saving
and the problem ends up in smoke. The image is scaled correct and no
infinite loop occures. I think there is a rounding failure anywhere deep in
the program on translation different unit of measures into pixels, which
produces this failure.

By Torsten

-----Original Message-----
From: fred redf [mailto:popincourt2000@yahoo.fr]
Sent: Montag, 29. April 2002 10:23
To: fop-dev@xml.apache.org; erlto@net-linx.de
Subject: RE: external-graphic size


Hi all,

I had the same prob in my project. I made a little
java class (based on some code i found on the
internet) that calculate the actual width of my image.
I call that class inside my xsl (thru xalan java
extension). Then, according to some rules, i configure
width="Xcm" inside external graphic tag.

Here is some example of my code :

-< snip


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


RE: external-graphic size

Posted by fred redf <po...@yahoo.fr>.
Hi all,

I had the same prob in my project. I made a little
java class (based on some code i found on the
internet) that calculate the actual width of my image.
I call that class inside my xsl (thru xalan java
extension). Then, according to some rules, i configure
width="Xcm" inside external graphic tag.

Here is some example of my code :

in the header zone :

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:java="http://xml.apache.org/xslt/java"
exclude-result-prefixes="java">

....

then in my xsl rule :

<xsl:template
match="ressource[@type='image']|ressource[@type='schema']">
<fo:block space-before="0.5cm" text-align="center"
keep-together="always">
<xsl:variable name="image">temp\images\<xsl:value-of
select="@URIsrc"/></xsl:variable>
<!-- compute the width of my image... -->
<xsl:variable name="pWidth"
select="java:com.scenari.papier.Largeur.hValeur($image)"/>
<fo:table>
<fo:table-column column-width="{$gLargeurPapier}cm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block>
<fo:external-graphic src="{$image}" 
keep-with-next="always" width="{$pWidth}cm"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row keep-with-previous="always">
<fo:table-cell>
<fo:block font-family="Helvetica" font-size="12pt"
text-align="center" space-after="0.1cm"
keep-with-previous="always" space-before="0.3cm">
<xsl:if test="@titre">
Fig. <xsl:number count="ressource[@type='image']"
level="any" format="1"/> : <xsl:value-of
select="@titre"/>
</xsl:if>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</xsl:template>

Hope this helps...
Fred.

--- Torsten Erler <er...@net-linx.de> a écrit : > Yes
I'm using this as temporarily solution to avoid
> program crashes, but
> even the image is scaled into the specified size,
> also if it has original
> size of e.g. 10x15 pixel. This produces a unusable
> chequered print-preview.
> 
> Is there another way to force the scaling only if
> the image overflows the
> dimension of the page body area???
> 
> P.S.: I've tried to overwrite AWTRenderers
> "renderImageArea(ImageArea
> area)"to scale the image before painting, but it
> seems to be the loop
> occures before on formatting the area tree (I'll
> debug this step by step, to
> find the precise position).
> 
> ThanX Torsten
> 
> -----Original Message-----
> From: J.Pietschmann [mailto:j3322ptm@yahoo.de]
> Sent: Montag, 29. April 2002 01:21
> To: fop-dev@xml.apache.org
> Subject: Re: external-graphic size
> 
> 
> Torsten Erler wrote:
> > I've a problem with external graphics, which can
> be greater than the page
> > size of the xsl-template. The properties
> max-height and max-width doesn't
> > work (not implemented). The result is an infinite
> loop on rendering the
> > (correctly) generated "fo"-file with the
> AWTRenderer to display the
> result.
> > Is there a workaround for that or have I omit an
> important setting
> (possible
> > in xsl) for a parent object.
> 
> Try setting height and/or width on the
> fo:external-graphic
> element. If you specify both, the graphic may be
> stretched,
> of you specify only one, the aspect ratio is
> conserved.
> 
> J.Pietschmann
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> fop-dev-unsubscribe@xml.apache.org
> For additional commands, email:
> fop-dev-help@xml.apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> fop-dev-unsubscribe@xml.apache.org
> For additional commands, email:
> fop-dev-help@xml.apache.org
>  

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

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


RE: external-graphic size

Posted by Torsten Erler <er...@net-linx.de>.
Yes I'm using this as temporarily solution to avoid program crashes, but
even the image is scaled into the specified size, also if it has original
size of e.g. 10x15 pixel. This produces a unusable chequered print-preview.

Is there another way to force the scaling only if the image overflows the
dimension of the page body area???

P.S.: I've tried to overwrite AWTRenderers "renderImageArea(ImageArea
area)"to scale the image before painting, but it seems to be the loop
occures before on formatting the area tree (I'll debug this step by step, to
find the precise position).

ThanX Torsten

-----Original Message-----
From: J.Pietschmann [mailto:j3322ptm@yahoo.de]
Sent: Montag, 29. April 2002 01:21
To: fop-dev@xml.apache.org
Subject: Re: external-graphic size


Torsten Erler wrote:
> I've a problem with external graphics, which can be greater than the page
> size of the xsl-template. The properties max-height and max-width doesn't
> work (not implemented). The result is an infinite loop on rendering the
> (correctly) generated "fo"-file with the AWTRenderer to display the
result.
> Is there a workaround for that or have I omit an important setting
(possible
> in xsl) for a parent object.

Try setting height and/or width on the fo:external-graphic
element. If you specify both, the graphic may be stretched,
of you specify only one, the aspect ratio is conserved.

J.Pietschmann



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


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


Re: external-graphic size

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Torsten Erler wrote:
> I've a problem with external graphics, which can be greater than the page
> size of the xsl-template. The properties max-height and max-width doesn't
> work (not implemented). The result is an infinite loop on rendering the
> (correctly) generated "fo"-file with the AWTRenderer to display the result.
> Is there a workaround for that or have I omit an important setting (possible
> in xsl) for a parent object.

Try setting height and/or width on the fo:external-graphic
element. If you specify both, the graphic may be stretched,
of you specify only one, the aspect ratio is conserved.

J.Pietschmann



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