You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

extensions.xml 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <?xml version="1.0" standalone="no"?>
  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 V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
  18. <document>
  19. <header>
  20. <title>Standard FOP Extensions</title>
  21. <version>$Revision$</version>
  22. </header>
  23. <body>
  24. <p>
  25. By "extension", we mean any data that can be placed in the input XML document that
  26. is not addressed by the XSL-FO standard.
  27. By having a mechanism for supporting extensions, FOP is able to add features that
  28. are not covered in the specification.
  29. </p>
  30. <p>
  31. The extensions documented here are included with FOP, and are automatically available
  32. to you. If you wish to add an extension of your own to FOP, please see the
  33. <a href="../dev/extensions.html">Developers' Extension Page</a>.
  34. </p>
  35. <note>All extensions require the correct use of an appropriate namespace in your input document.</note>
  36. <section id="svg">
  37. <title>SVG</title>
  38. <p>
  39. Please see the <a href="graphics.html#svg">SVG documentation</a> for more details.
  40. </p>
  41. </section>
  42. <section id="fo-extensions">
  43. <title>FO Extensions</title>
  44. <section id="fox-namespace">
  45. <title>Namespace</title>
  46. <p>
  47. By convention, FO extensions in FOP use the "fox" namespace prefix.
  48. To use any of the FO extensions, add a namespace entry for
  49. <code>http://xml.apache.org/fop/extensions</code> to the root element:
  50. </p>
  51. <source><![CDATA[<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
  52. xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">]]></source>
  53. </section>
  54. <section id="bookmarks">
  55. <title>PDF Bookmarks</title>
  56. <p>
  57. In previous versions of Apache FOP there was a <code>fox:outline</code> element
  58. which was used to create outlines in PDF files. The redesigned code makes use
  59. of the new <a href="http://www.w3.org/TR/xsl11/#fo_bookmark-tree">bookmark feature defined in the latest XSL 1.1 working draft</a>.
  60. </p>
  61. </section>
  62. <section id="named-destinations">
  63. <title>Anchors or Named Destinations</title>
  64. <p>Use the fox:destination element to define "named destinations" inside a PDF document.
  65. These are useful as fragment identifiers, e.g. "http://server/document.pdf#anchor-name".
  66. fox:destination elements can be placed almost anywhere in the fo document, including a child of
  67. root, a block-level element, or an inline-level element.
  68. For the destination to actually work, it must correspond to an "id" attribute on some fo element
  69. within the document. In other words, the "id" attribute actually creates the "view" within the
  70. PDF document. The fox:destination simply gives that view an independent name.
  71. </p>
  72. <source><![CDATA[<fox:destination internal-destination="table-of-contents"/>
  73. ...
  74. <fo:block id="table-of-contents">Table of Contents</fo:block>]]></source>
  75. <warning>It is possible that in some future release of FOP, <em>all </em>elements with
  76. "id" attributes will generate named-destinations, which will eliminate the need for
  77. fox:destination.</warning>
  78. </section>
  79. <section id="table-continue-label">
  80. <title>Table Continuation Label</title>
  81. <p>This extension element hasn't been reimplemented for the redesigned code, yet.</p>
  82. <!--p>Use the fox:continued-label element to create content in table-header and
  83. table-footer cells that will appear only on pages after the first page that the table
  84. appears. fox:continued-label is itself inline content, and is a container of fo:inline
  85. content. This content will be laid out only if the table does not fit on a single page and flows
  86. to following pages. Here is an example of FO code creating such a table-header:</p>
  87. <source><![CDATA[<fo:table-header>
  88. <fo:table-row>
  89. <fo:table-cell>
  90. <fo:block>Header column 1 with continued label
  91. <fox:continued-label><fo:inline> (cont.)</fo:inline></fox:continued-label>
  92. </fo:block>
  93. </fo:table-cell>
  94. <fo:table-cell>
  95. <fo:block>Header column 2 with no continued label</fo:block>
  96. </fo:table-cell>
  97. </fo:table-row>
  98. </fo:table-header>]]></source-->
  99. </section>
  100. <section id="widow-orphan-content-limit">
  101. <title>fox:orphan-content-limit and fox:widow-content-limit</title>
  102. <p>
  103. The two proprietary extension properties, fox:orphan-content-limit and
  104. fox:widow-content-limit, are used to improve the layout of list-blocks and tables.
  105. If you have a table with many entries, you don't want a single row to be left over
  106. on a page. You will want to make sure that at least two or three lines are kept
  107. together. The properties take an absolute length which specifies the area at the
  108. beginning (fox:widow-content-limit) or at the end (fox:orphan-content-limit) of a
  109. table or list-block. The properties are inherited and only have an effect on fo:table
  110. and fo:list-block. An example: fox:widow-content-limit="3 * 1.2em" would make sure
  111. the you'll have at least three lines (assuming line-height="1.2") together on a table
  112. or list-block.
  113. </p>
  114. </section>
  115. <section id="external-document">
  116. <title>fox:external-document</title>
  117. <note>
  118. This feature is incomplete. Support for multi-page documents will be added shortly.
  119. At the moment, only single-page images will work. And this will not work with RTF output.
  120. </note>
  121. <p>
  122. This is a proprietary extension element which allows to add whole images as pages to
  123. an FO document. For example, if you have a scanned document or a fax as multi-page TIFF
  124. file, you can append or insert this document using the <code>fox:external-document</code>
  125. element. Each page of the external document will create one full page in the target
  126. format.
  127. </p>
  128. <p>
  129. The <code>fox:external-document</code> element is structurally a peer to
  130. <code>fo:page-sequence</code>, so wherever you can put an <code>fo:page-sequence</code>
  131. you could also place a <code>fox:external-document</code>.
  132. Therefore, the specified contents for <code>fo:root</code> change to:
  133. </p>
  134. <p>
  135. <code>
  136. (layout-master-set, declarations?, bookmark-tree?, (page-sequence|page-sequence-wrapper|fox:external-document|fox:destination)+)
  137. </code>
  138. </p>
  139. <section>
  140. <title>Specification</title>
  141. <p>
  142. The <code>fox:external-document</code> extension formatting object is used to specify
  143. how to create a (sub-)sequence of pages within a document. The content of these pages
  144. comes from the individual subimages/pages of an image or paged document (for example:
  145. multi-page TIFF in the form of faxes or scanned documents, or PDF files). The
  146. formatting object creates the necessary areas to display one image per page.
  147. </p>
  148. <p>
  149. In terms of page numbers, the behaviour is the same as for
  150. <code>fo:page-sequence</code>. The placement of the image inside the page is similar
  151. to that of <code>fo:external-graphic</code> or <code>fo:instream-foreign-object</code>,
  152. i.e. the viewport (and therefore the page size) is defined by either the intrinsic
  153. size of the image or by the size properties that apply to this formatting object.
  154. </p>
  155. <p>Content: EMPTY</p>
  156. <p>The following properties apply to this formatting object:</p>
  157. <ul>
  158. <li>(Common Accessibility Properties) (not implemented, yet)</li>
  159. <li>(Common Aural Properties) (not implemented, yet)</li>
  160. <li>block-progression-dimension</li>
  161. <li>content-height</li>
  162. <li>content-type</li>
  163. <li>content-width</li>
  164. <li>display-align</li>
  165. <li>height</li>
  166. <li>id</li>
  167. <li>inline-progression-dimension</li>
  168. <li>overflow</li>
  169. <li>pages: &lt;page-set&gt; (see below) (not implemented, yet)</li>
  170. <li>reference-orientation</li>
  171. <li>scaling</li>
  172. <li>scaling-method</li>
  173. <li>src</li>
  174. <li>text-align</li>
  175. <li>width</li>
  176. </ul>
  177. <p>
  178. Datatype "page-set": Value: auto | &lt;integer-range&gt;,
  179. Default: "auto" which means all pages/subimages of the document.
  180. &lt;integer-range&gt; allows values such as "7" or "1-3"
  181. </p>
  182. <note>
  183. <code>fox:external-document</code> is not suitable for concatenating FO documents.
  184. For this, XInclude is recommended.
  185. </note>
  186. </section>
  187. </section>
  188. <section id="transform">
  189. <title>Free-form Transformation for fo:block-container</title>
  190. <p>
  191. For <code>fo:block-container</code> elements whose <code>absolute-position</code> set to
  192. "absolute" or "fixed" you can use the extension attribute <code>fox:transform</code>
  193. to apply a free-form transformation to the whole block-container. The content of the
  194. <code>fox:transform</code> attribute is the same as for
  195. <a href="http://www.w3.org/TR/SVG/coords.html#TransformAttribute">SVG's transform attribute</a>.
  196. The transformation specified here is performed in addition to other implicit
  197. transformations of the block-container (resulting from top, left and other properties)
  198. and after them.
  199. </p>
  200. <p>
  201. Examples: <code>fox:transform="rotate(45)"</code> would rotate the block-container
  202. by 45 degrees clock-wise around its upper-left corner.
  203. <code>fox:transform="translate(10000,0)"</code> would move the block-container to the
  204. right by 10 points (=10000 millipoints, FOP uses millipoints internally!).
  205. </p>
  206. <note>
  207. This extension attribute doesn't work for all output formats! It's currently only
  208. supported for PDF, PS and Java2D-based renderers.
  209. </note>
  210. </section>
  211. <section id="color-functions">
  212. <title>Color functions</title>
  213. <p>
  214. XSL-FO supports specifying color using the rgb(), rgb-icc() and system-color() functions.
  215. Apache FOP provides additional color functions for special use cases. Please note that
  216. using these functions compromises the interoperability of an FO document.
  217. </p>
  218. <section id="color-function-cmyk">
  219. <title>cmyk()</title>
  220. <p><code>color cmyk(numeric, numeric, numeric, numeric)</code></p>
  221. <p>
  222. This function will construct a color in device-specific CMYK color space. The numbers
  223. must be between 0.0 and 1.0. For output formats that don't support device-specific
  224. color space the CMYK value is converted to an sRGB value.
  225. </p>
  226. </section>
  227. </section>
  228. </section>
  229. </body>
  230. </document>