Open main menu

Wikibooks β

XQuery/XSL-FO Images

< XQuery



You want to enrich your documents with print quality images and charts etc.


We will use the fo:external-graphic primitive.

For example, to add an external image add a block to the XSL-FO:

    <fo:external-graphic src="https://tet/static/favicon.ico?r=2"/>


Vector ImagesEdit

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:external-graphic src="http://localhost:8080/exist/rest/db/logo.svg"/>

PDF image extensionEdit

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
$ 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.