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 Diego F Guillen <ad...@tpg.com.au> on 2006/03/30 10:36:16 UTC

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: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: displaying images in XSL-FO for Apache Cocoon

Posted by Diego F Guillen <ad...@tpg.com.au>.
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: fop-users-return-19875-kmuetz=web.de@xmlgraphics.apache.org
>>[mailto:fop-users-return-19875-kmuetz=web.de@xmlgraphics.apache.org]On
>>Behalf Of Diego F Guillen
>>Sent: Thursday, March 30, 2006 10:36 AM
>>To: fop-users@xmlgraphics.apache.org
>>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: fop-users-unsubscribe@xmlgraphics.apache.org
>>For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>
>
>  
>

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


RE: displaying images in XSL-FO for Apache Cocoon

Posted by Kai Mütz <km...@web.de>.
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: fop-users-return-19875-kmuetz=web.de@xmlgraphics.apache.org
> [mailto:fop-users-return-19875-kmuetz=web.de@xmlgraphics.apache.org]On
> Behalf Of Diego F Guillen
> Sent: Thursday, March 30, 2006 10:36 AM
> To: fop-users@xmlgraphics.apache.org
> 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: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>


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