Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

extensions.xml 3.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one or more
  4. contributor license agreements. See the NOTICE file distributed with
  5. this work for additional information regarding copyright ownership.
  6. The ASF licenses this file to You under the Apache License, Version 2.0
  7. (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. -->
  16. <!-- $Id$ -->
  17. <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.3//EN" "http://forrest.apache.org/dtd/document-v13.dtd">
  18. <document>
  19. <header>
  20. <title>Apache™ FOP Development: Adding an Extension</title>
  21. <version>$Revision$</version>
  22. </header>
  23. <body>
  24. <section id="overview">
  25. <title>Overview</title>
  26. <p>For documentation of standard Apache™ FOP extensions, see the <link href="../trunk/extensions.html">User FOP Extensions</link> document.</p>
  27. <p>
  28. If the default funtionality of FOP needs to be extended for
  29. some reason then you can write an extension.
  30. </p>
  31. <p>There are three types of extensions possible:</p>
  32. <ul>
  33. <li>An output document extension such as the PDF bookmarks</li>
  34. <li>an instream-foreign-object extensions such as SVG</li>
  35. <li>an fo extension that creates an area in the area tree where normal xsl:fo is not possible</li>
  36. </ul>
  37. </section>
  38. <section id="adding">
  39. <title>Adding Your Own</title>
  40. <p>
  41. To add your own extension you need to do the following things.
  42. </p>
  43. <ol>
  44. <li>Write code that implements your extension functionality. The easiest place to
  45. start is by looking at the code in org.apache.fop.fo.extensions, and by looking at the examples in the <code>examples</code> directory.</li>
  46. <li>Create a class that extends the abstract org.apache.fop.fo.ElementMapping class. ElementMapping is a hashmap of all of the elements in a particular namespace, which makes it easier for FOP to create a different object for each element.
  47. ElementMapping objects are static to save on memory.
  48. They are loaded by FOP when parsing starts to validate input.</li>
  49. <li>Create the following file: "/META-INF/services/org.apache.fop.fo.ElementMapping", which should contain the fully qualified classname of your ElementMapping implementation class.</li>
  50. <li>Create a jar file containing all of the above files.</li>
  51. <li>Create your XSL-FO file with the extra XML data embedded in the file with the
  52. correct name space.
  53. The examples for SVG and pdfoutline.fo show how this can be done.
  54. The pdf documents on the FOP site use this extension.
  55. See also <link href="../examples.html">Examples</link> for more examples.</li>
  56. <li>Put your jar file in the classpath</li>
  57. <li>Run FOP using your XSL-FO file as input.</li>
  58. </ol>
  59. </section>
  60. </body>
  61. </document>