summaryrefslogtreecommitdiffstats
path: root/src/documentation/content/xdocs/dev/extensions.xml
blob: 9c77e53a81c0278f0003de294e3c42ca0ea4e4bd (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
<?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>Adding an Extension to FOP</title>
  </header>
  <body>
    <section id="overview">
      <title>Overview</title>
      <p>For documentation of standard FOP extenstions, see the <link href="../extensions.html">User FOP Extensions</link> document.</p>
      <p>
If the default funtionality of FOP needs to be extended for
some reason then you can write an extension.
            </p>
            <p>There are three types of extensions possible:</p>
            <ul>
              <li>An output document extension such as the PDF bookmarks</li>
              <li>an instream-foreign-object extensions such as SVG</li>
              <li>an fo extension that creates an area in the area tree where normal xsl:fo is not possible</li>
            </ul>
          </section>
          <section id="adding">
            <title>Adding Your Own</title>
            <p>
To add your own extension you need to do the following things.
</p>
        <ol>
          <li>Write code that implements your extension functionality. The easiest place to
start is by looking at the code in org.apache.fop.extension, and by looking at the examples in the <code>contrib</code> directory.</li>
          <li>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.</li>
          <li>Create your XSL-FO file with the extra XML data embedded in the file with the
correct name space.
The examples for SVG and pdfoutline.fo show how this can be done.
The pdf documents on the FOP site use this extension.
See also <link href="examples.html">Examples</link> for more examples.</li>
          <li>Put your jar file in the classpath</li>
          <li>Run FOP using your XSL-FO file as input.</li> 
        </ol>
    </section>
  </body>
</document>