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=imagetemp\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 [EMAIL PROTECTED] 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:[EMAIL PROTECTED]]
Sent: Montag, 29. April 2002 01:21
To: [EMAIL PROTECTED]
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:
[EMAIL PROTECTED]
For additional commands, email:
[EMAIL PROTECTED]
-
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, email:
[EMAIL PROTECTED]
___
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]