411 REFERENCE · Wikibooks
XQuery/XSL-FO Images
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Motivation
You want to enrich your documents with print quality images and charts etc.
Method
We will use the fo:external-graphic primitive.
For example, to add an external image add a block to the XSL-FO:
<fo:block>
<fo:external-graphic src="https://tet/static/favicon.ico?r=2"/>
</fo:block>
execute
Vector Images
SVG is a standard way to describe graphical artwork as vectors. Recent eXist installations (>1.4) with the Apache FOP processor enabled can embed SVG data in the resulting PDF as vector art: just reference them via http redirection as they are not in the file system. See ../Generating PDF from XSL-FO files/ on how to activate the XSLFO feature.
<fo:block>
<fo:external-graphic src="http://localhost:8080/exist/rest/db/logo.svg"/>
</fo:block>
PDF image extension
For the daring: there is an extension to apache fop, that provides for pdf-images: a method of placing pages of PDF files in the FOP output. Its the work of Jeremias Märki and available at his webspace.
$ wget http://www.jeremias-maerki.ch/download/fop/pdf-images/fop-pdf-images-2.0.0.SNAPSHOT-bin.tar.gz
$ tar xfz fop-pdf-images-2.0.0.SNAPSHOT-bin.tar.gz
$ cp fop-pdf-images-2.0.0.SNAPSHOT/*jar EXIST_HOME/lib/user
I had to restart exist to activate pdf-images support in fop. The fo syntax is the same as with SVG, a page-number can be specified after a hash sign in the URL.