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 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <?xml version="1.0" encoding="UTF-8" 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 Apache™ 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, Apache™ 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://xmlgraphics.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 old 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 <a href="http://www.w3.org/TR/xsl11/#fo_bookmark-tree">bookmark feature defined in the W3C XSL 1.1 standard</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 id="pseudo-color-profiles">
  228. <title>#CMYK pseudo-profile</title>
  229. <p><code>color rgb-icc(numeric, numeric, numeric, #CMYK, numeric, numeric, numeric, numeric)</code></p>
  230. <p>
  231. The <code>rgb-icc</code> function will respond to a pseudo-profile called "#CMYK"
  232. which indicates a device-specific CMYK color space. The "#CMYK" profile is implicitely
  233. available and doesn't have to be (and cannot be) defined through an
  234. <code>fo:color-profile</code> element. It is provided for compatibility with certain
  235. commercial XSL-FO implementations. Please note that this is not part of the official
  236. specification but rather a convention. The following two color specifications are
  237. equivalent:
  238. </p>
  239. <ul>
  240. <li><code>cmyk(0%,0%,20%,40%)</code></li>
  241. <li><code>rgb-icc(153, 153, 102, #CMYK, 0, 0, 0.2, 0.4)</code></li>
  242. </ul>
  243. </section>
  244. </section>
  245. <section id="prepress">
  246. <title>Prepress Support</title>
  247. <p>
  248. This section defines a number of extensions related to
  249. <a href="http://en.wikipedia.org/wiki/Prepress">prepress</a> support.
  250. <code>fox:scale</code> defines a general scale factor for the generated pages.
  251. <code>fox:bleed</code> defines the
  252. <a href="http://en.wikipedia.org/wiki/Bleed_%28printing%29">bleed area</a> for a page.
  253. <code>fox:crop-offset</code> defines the outer edges of the area in which crop marks,
  254. registration marks, color bars and page information are placed.
  255. For details, please read on below.
  256. </p>
  257. <note>
  258. Those extensions have been implemented in the PDF and Java2D renderers only.
  259. </note>
  260. <section id="scale">
  261. <title>fox:scale</title>
  262. <p>Value: &lt;number&gt;{1,2}</p>
  263. <p>Initial: 1</p>
  264. <p>Applies to: fo:simple-page-master</p>
  265. <p>
  266. This property specifies a scale factor along resp. the x and y axes. If only one number
  267. is provided it is used for both the x and y scales. A scale factor smaller than 1
  268. shrinks the page. A scale factor greater than 1 enlarges the page.
  269. </p>
  270. </section>
  271. <section id="bleed">
  272. <title>fox:bleed</title>
  273. <p>
  274. Value: &lt;length&gt;{1,4}
  275. </p>
  276. <p>
  277. Initial: 0pt
  278. </p>
  279. <p>Applies to: fo:simple-page-master</p>
  280. <p>
  281. If there is only one value, it applies to all sides. If there are two values, the top and bottom
  282. bleed widths are set to the first value and the right and left bleed widths are set to the second.
  283. If there are three values, the top is set to the first value, the left and right are set to the second,
  284. and the bottom is set to the third. If there are four values, they apply to the top, right, bottom, and
  285. left, respectively.
  286. (Corresponds to <a href="http://www.w3.org/TR/xsl11/#padding">the definition of
  287. padding</a>).
  288. </p>
  289. <p>
  290. This extension indirectly defines the BleedBox and is calculated by expanding the TrimBox by
  291. the bleed widths. The lengths must be non-negative.
  292. </p>
  293. </section>
  294. <section id="cropOffset">
  295. <title>fox:crop-offset</title>
  296. <p>
  297. Value: &lt;length&gt;{1,4}
  298. </p>
  299. <p>
  300. Initial: bleed (see below)
  301. </p>
  302. <p>Applies to: fo:simple-page-master</p>
  303. <p>
  304. Same behaviour as with fox:bleed. The initial value is set to the same values as the
  305. fox:bleed property.
  306. </p>
  307. <p>
  308. This extension indirectly defines the MediaBox and is calculated by expanding
  309. the TrimBox by the crop offsets. The lengths must be non-negative.
  310. </p>
  311. </section>
  312. <section id="cropBox">
  313. <title>fox:crop-box</title>
  314. <p>
  315. Value: [trim-box | bleed-box | media-box]
  316. </p>
  317. <p>
  318. Initial: media-box
  319. </p>
  320. <p>Applies to: fo:simple-page-master</p>
  321. <p>
  322. The crop box controls how Acrobat displays the page (CropBox in PDF) or how the Java2DRenderer sizes
  323. the output media. The PDF specification defines that the CropBox defaults to the MediaBox. This extension
  324. follows that definition. To simplify usage and cover most use cases, the three supported enumeration
  325. values "trim-box", "bleed-box" and "media-box" set the CropBox to one of those three other boxes.
  326. </p>
  327. <p>
  328. If requested in the future, we could offer to specify the CropBox in absolute coordinates rather
  329. than just by referencing another box.
  330. </p>
  331. </section>
  332. </section>
  333. </section>
  334. </body>
  335. </document>