XQuery/XSL-FO Images
Motivation
[edit | edit source]You want to enrich your documents with print quality images and charts etc.
Method
[edit | edit source]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>
Vector Images
[edit | edit source]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
[edit | edit source]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.