cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Stevens" <at...@hotmail.com>
Subject RE: PDF: external-graphic & absolute path
Date Thu, 20 Jul 2006 17:39:41 GMT
>From: "Omar Adobati" <omar.adobati@gmail.com>
>Date: Thu, 20 Jul 2006 10:40:09 +0200
>
>Good Morning,
>
>  What is the reason I need to use the full path of an image I want to
>display into a PDF generated file?

I believe it's a limitation of Apache FOP.  I was recently working on a 
(non-Cocoon) servlet that used XSL/FOP to generate a PDF, and had to use the 
full URLs in that also.

>This way to use images kills
>portability, Not always the code one develop will runs on the same
>machine he use to write the code...

I worked around that by passing in the host/port/context (read from the 
request object) as a parameter to the XSL transformation.  You could do much 
the same with Cocoon using something like
<map:transform type="xsl" src="whatever.xsl">
   <map:parameter name="baseUrl" 
value="http://{request:serverName}:{request:serverPort}{request:contextPath}"/>
in your sitemap and
<xsl:param name="baseUrl"/>
...
<fo:external-graphic src="{$baseUrl}/images/my_logo.png"/>
in the XSLT stylesheet.  This avoids having to hard code the server in your 
XSL.

>And, more, how to resize the image? I have tried to use content-height
>and content-weight attributes, but they seems to not work... any
>suggestion (I know I could resize it with an image editor software,
>but I'd like to not do this for many reasons).

I can't remember how I ended up that way, but nearly all the 
external-graphic elements in my XSL were using both width and content-width 
attributes (I let it scale the height automatically to preserve the aspect 
ration).  I have a feeling that when I only used content-width it didn't 
work, or maybe it was the other way round.  The other external-graphic in 
that file has only a height attribute, so perhaps it's height and width that 
are needed to get it to work properly rather than content-height & 
content-width?


Andrew.



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


Mime
View raw message