Hi Christian,
Thank you for your observation.
I don't think it works, because of the way Cocoon resolves paths.
I solved the problem in the following way, following Kai's suggestion.
[this is a solution for FOP 0.20.5 embedded in Cocoon 2.1.8]
1. Edit WEB-INF/sitemap.xmap:
<map:serializer name="fo2pdf" ...>
<user-config>fop-config.xml</user-config>
</map:serializer>
2. Copy file from fop-0.20.5\conf\userconfig.xml
to <cocoon-path>\build\webapp\test\fop-config.xml
3. Edit this (fop-config.xml) file and add the following entry:
<entry>
<key>baseDir</key>
<value><cocoon-path>\build\webapp\test</value>
</entry>
It worked for me.
Thanks,
Diego Guillen
Christian Loock wrote:
Hi,
i guess that the pass isn correct:
images/
myimage.gif
styles/
mydbk2pdf.xsl (containing the code above)
if your xsl is in root/styles/ and the image is in root/images/ the relative
path from styles to images is ../images, so you should try as follows:
<fo:external-graphic src="../images/myimage.gif"/>
-----Original Message-----
From: Diego F Guillen [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 30, 2006 12:12 PM
To: [email protected]
Subject: Re: displaying images in XSL-FO for Apache Cocoon
Hi Kai,
Thank you very much for the insight. It worked !!!
And the fo's syntax is:
<fo:external-graphic src="url('images/myimage.gif')"/> It also works without
the url():
<fo:external-graphic src="images/myimage.gif"/>
Best regards,
Diego Guillen
Kai Mütz wrote:
You can configure the FOPSerializer in sitemap.xmap to use a user
config file where you can set the base directory:
<map:serializer logger="sitemap.serializer.fo2pdf"
mime-type="application/pdf" name="fo2pdf"
src="org.apache.cocoon.serialization.FOPSerializer">
<user-config>WEB-INF/fop-config.xml</user-config>
</map:serializer>
http://xmlgraphics.apache.org/fop/0.20.5/configuration.html
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Behalf Of Diego F Guillen
Sent: Thursday, March 30, 2006 10:36 AM
To: [email protected]
Subject: displaying images in XSL-FO for Apache Cocoon
Hi all,
I have been using Apache Cocoon 2.1.8 (which uses Apache FOP 0.20.5).
I have coded xsl-fo and managed to display PDF successfully with:
headers, footers, paragraphs, lists, and tables.
However, here is where I need your help:
I have generated the following xsl-fo for displaying images in PDF,
which doesn't seem to work:
[I've tried all of the cases below, without results] [I'm omitting the
enclosing <fo> tags]
<fo:external-graphic src="images/myimage.gif"/> <fo:external-graphic
src="*url(*images/myimage.gif*)*"/>
<fo:external-graphic src="*file:/*images/myimage.gif"/>
<fo:external-graphic src="*url(file:/*images/myimage.gif*)*"/>
<fo:external-graphic src="*../*images/myimage.gif"/>
<fo:external-graphic src="*url(../*images/myimage.gif*)*"/>
<fo:external-graphic src="*file:/../*images/myimage.gif"/>
<fo:external-graphic src="*url(file:/../*images/myimage.gif*)*"/>
My project structure is:
* test/
sitemap.xmap
content/
testfile.xml (containing docbook)
images/
myimage.gif
styles/
mydbk2pdf.xsl (containing the code above)
My sitemap.xmap contains the following fragments:
<!-- for processing pdf requests -->
<map:match pattern="test/*.pdf">
<map:generate type="file" src="test/content/{1}.xml"/>
<map:transform type="xslt" src="styles/mydbk2pdf.xsl"/>
<map:serialize type="fo2pdf"/>
</map:match>
<!-- for processing images -->
<map:match pattern="images/**.gif">
<map:read src="context://test/images/{1}.gif"
mime-type="image/gif"/>
</map:match>
Your insight will be much appreciated.
I would also appreciate if someone could give me an example that works.
Best resgards,
Diego Guillen
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]