Embedding SVG examplesPage
Embedding SVG
A less cute tiger
Some examples of how to embed an SVG image inside your FO documents
Introduction
This document shows some examples of how an SVG document can be embedded directly in
an fo document and how FOP will render it.
There are a couple of ways to specify the XML for embedding.
There are a number of factors which specify exactly how the SVG image will be rendered, such as size, clipping etc.
Note: if you want to know about SVG itself you should consult the appropriate SVG resource. The Batik Project is a good resource for information about SVG and samples etc.
XML Syntax
Here we have some examples of how the XML can be specified in the fo document.
This first example specifies the name space on the instream-foreign-object using the xmlns:svg attribute.
Then all the svg elements start with the svg: namespace prefix. It can be specified on any element
above where the svg:svg tag appears (eg. fo:root).
]]>
This example specifies the name space on the svg:svg element using the xmlns:svg attribute.
Then all the svg elements start with the svg: namespace prefix.
It is able to determine the namespace for the current element.
]]>
This example specifies the namespace for the current element, rather than for the svg: prefix.
This means that all elements under this one are assumed to have the same namespace.
]]>
Sizing
The size of the instream-foreign-object is obtained in a number of ways.
Specify the size on the instream-foreign-object element.
]]>
Specify the size on the svg document element.
]]>
Specify the size on the svg document element and for the content size on the instream-foreign-object.
]]>
Clipping
Interesting Functionality