blob: 654976a30b9bd50817f52522dd14f490f63f7cb5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.1//EN"
"http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-forrest/src/resources/schema/dtd/document-v11.dtd">
<document>
<header>
<title>Extensions to FOP</title>
</header>
<body>
<section>
<title>Overview</title>
<p>
If the default funtionality of FOP needs to be extended for
some reason then you can write an extensions.
</p>
<p>
There are three types of extensions possible. An output document
extensions such as the PDF bookmarks, an instream-foreign-object
extensions such as SVG and an fo extension that creates an
area in the area tree where normal xsl:fo is not possible.
</p>
</section>
<section>
<title>Default Extensions</title>
<p>
These extension are available by default. They are automatically loaded
and you only need to provide the correct namespace for your embedded
xml markup.
</p>
<section>
<title>SVG</title>
<p>
Please see the <link href="svg.html">SVG page</link> for more details.
</p>
<p>
The SVG extensions gets all the xml elements in the SVG namespace
and builds an SVG DOM with batik. The SVG DOM is then rendered
to the output format using a handler for the XML content of
the instream-foreign-object.
</p>
</section>
<section>
<title>PDF Bookmarks</title>
<p>
To use this standard Fop extension, you need to add a namespace entry for
http://xml.apache.org/fop/extensions on the root element. </p>
<p>You can provide outlines inside the root object (but outside
any page-sequences or
other formatting objects). Here's an example of an outline entry:</p>
<source>
<![CDATA[<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:fox="http://xml.apache.org/fop/extensions">
<fox:bookmarks>
<fox:outline internal-destination="sec3">
<fox:label>Running FOP</fox:label>
<fox:outline internal-destination="sec3-1">
<fox:label>Prerequisites</fox:label>
</fox:outline>
<fox:outline>
</fox:bookmarks>
</fo:root>]]></source>
<p>It works similarly to a basic-link. There is also an external-destination
property, but it isn't supported currently. The documents
on the fop-site use this extension so you can see it in action.
</p>
</section>
</section>
<section>
<title>Adding Your Own</title>
<p>
To add your own extension you need to do the following things.
</p>
<p>
Write code that implements your extension functionality.
There are some examples in the contrib/ directory.
</p>
<p>
Create a jar file with your classes, it must also include the
following file "/META-INF/services/org.apache.fop.fo.ElementMapping".
In this file you need to put the fully qualified classname of
your element mappings class. This class must implement the
"org.apache.fop.fo.ElementMapping" interface.
</p>
<p>
Create your fo file with the extra xml data embedded in the file
with the correct name space. The pdf documents on the fob site
use this extension, see <link href="examples.html">Examples</link>
for more examples.
</p>
<p>
Put your jar file in the classpath and then run fop over the fo file.
</p>
</section>
</body>
</document>
|