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.

embedding.xml 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  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 V1.1//EN"
  18. "http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-forrest/src/core/context/resources/schema/dtd/document-v12.dtd">
  19. <!-- Embedding FOP -->
  20. <document>
  21. <header>
  22. <title>FOP: Embedding</title>
  23. <subtitle>How to Embed FOP in a Java application</subtitle>
  24. <version>$Revision$</version>
  25. </header>
  26. <body>
  27. <section id="overview">
  28. <title>Overview</title>
  29. <p>Review <link href="running.html">Running FOP</link> for important information that applies to embedded applications as well as command-line use, such as options and performance.
  30. </p>
  31. <p>To embed FOP in your application, instantiate org.apache.fop.apps.Driver.
  32. Once this class is
  33. instantiated, methods are called to set the
  34. Renderer to use
  35. and the OutputStream to use to output the results of the
  36. rendering (where applicable). In the case of the Renderer and
  37. ElementMapping(s), the Driver may be supplied either with the
  38. object itself, or the name of the class, in which case Driver will
  39. instantiate the class itself. The advantage of the latter is it
  40. enables runtime determination of Renderer and ElementMapping(s).
  41. </p>
  42. </section>
  43. <section id="basics">
  44. <title>Basics</title>
  45. <p>The simplest way to use Driver is to instantiate it with the
  46. InputSource and OutputStream, then set the renderer desired and
  47. call the run method.
  48. </p>
  49. <p>Here is an example use of Driver which outputs PDF:
  50. </p>
  51. <source><![CDATA[
  52. import org.apache.fop.apps.Driver;
  53. /*..*/
  54. Driver driver = new Driver(new InputSource(args[0]),
  55. new FileOutputStream(args[1]));
  56. driver.setRenderer(Driver.RENDER_PDF);
  57. driver.run();]]></source>
  58. <p>
  59. In the example above, args[0] contains the path to an XSL-FO file, while
  60. args[1] contains a path for the target PDF file.
  61. </p>
  62. <section id="basic-logging">
  63. <title>Logging</title>
  64. <p>
  65. You also need to set up logging. Global logging for all FOP
  66. processes is managed by MessageHandler. Per-instance logging
  67. is handled by Driver. You want to set both using an implementation
  68. of org.apache.avalon.framework.logger.Logger. See
  69. <jump href="#logging">below</jump> for more information.
  70. </p>
  71. <p>
  72. Call <code>setLogger(Logger)</code> always immediately after
  73. instantiating the Driver object. See here:
  74. </p>
  75. <source><![CDATA[
  76. import org.apache.avalon.framework.logger.Logger;
  77. import org.apache.avalon.framework.logger.ConsoleLogger;
  78. /*..*/
  79. Driver driver = new Driver();
  80. Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
  81. MessageHandler.setScreenLogger(logger);
  82. driver.setLogger(logger);]]></source>
  83. </section>
  84. <section id="basic-logging-new-version">
  85. <title>Logging (Upcoming FOP 1.0 Version only)</title>
  86. <p>
  87. Logging is handled automatically via Jakarta Commons-Logging, which uses
  88. JDK logging by default. No special driver configuration is needed.
  89. For specialized configuration of Commons-Logging (e.g. to use a
  90. different logger or to change logging levels), please see the
  91. <fork href="http://jakarta.apache.org/commons/logging/">Jakarta Commons-Logging</fork>
  92. site.
  93. </p>
  94. </section>
  95. <section id="render">
  96. <title>Processing XSL-FO</title>
  97. <p>
  98. Once the Driver is set up, one of the <code>render()</code> methods
  99. is called. Depending on whether DOM or an InputSource is being used, the
  100. invocation of the method is either <code>render(Document)</code> or
  101. <code>render(Parser, InputSource)</code> respectively.
  102. </p>
  103. <p>
  104. <strong>Another possibility may be used to build the FO Tree: You can
  105. call <code>getContentHandler()</code> and fire the SAX events yourself.
  106. </strong>
  107. You don't have to call <code>run()</code> or <code>render()</code> on the
  108. Driver object if you use <code>getContentHandler()</code>.
  109. </p>
  110. <p>Here is an example use of Driver:</p>
  111. <source><![CDATA[
  112. Driver driver = new Driver();
  113. //Setup logging here: driver.setLogger(...
  114. driver.setRenderer(Driver.RENDER_PDF);
  115. driver.setInputSource(new FileInputSource(args[0]));
  116. driver.setOutputStream(new FileOutputStream(args[1]));
  117. driver.run();]]></source>
  118. </section>
  119. <section id="render-with-xslt">
  120. <title>Processing XSL-FO generated from XML+XSLT</title>
  121. <p>
  122. If you want to process XSL-FO generated from XML using XSLT we recommend
  123. using standard JAXP to do the XSLT part and piping the generated SAX
  124. events directly through to FOP. Here's how this would look like:
  125. </p>
  126. <source><![CDATA[
  127. Driver driver = new Driver();
  128. //Setup logging here: driver.setLogger(...
  129. driver.setRenderer(Driver.RENDER_PDF);
  130. //Setup the OutputStream for FOP
  131. driver.setOutputStream(new java.io.FileOutputStream(outFile));
  132. //Make sure the XSL transformation's result is piped through to FOP
  133. Result res = new SAXResult(driver.getContentHandler());
  134. //Setup XML input
  135. Source src = new StreamSource(xmlFile);
  136. //Setup Transformer
  137. Source xsltSrc = new StreamSource(xslFile);
  138. TransformerFactory transformerFactory = TransformerFactory.newInstance();
  139. Transformer transformer = transformerFactory.newTransformer(xsltSrc);
  140. //Start the transformation and rendering process
  141. transformer.transform(src, res);]]></source>
  142. <note>There's no need to call <code>run()</code> or <code>render()</code>.</note>
  143. <p>
  144. This may look complicated at first, but it's really just the combination of an
  145. XSL transformation and a FOP run. It's also easy to comment out the FOP part
  146. for debugging purposes, for example when you're tracking down a bug in your
  147. stylesheet. You can easily write the XSL-FO output from the XSL transformation
  148. to a file to check if that part generates the expected output.
  149. </p>
  150. <p>
  151. For fully working examples of the above and hints to some interesting
  152. possibilities, see the <link href="#examples">examples section</link> below.
  153. </p>
  154. </section>
  155. </section>
  156. <section id="logging">
  157. <title>Controlling logging</title>
  158. <p>
  159. Current FOP 0.20.x production uses the
  160. <fork href="http://avalon.apache.org/framework/api/org/apache/avalon/framework/logger/package-summary.html">Logger package</fork>
  161. from Apache Avalon Framework to do logging. See the
  162. <fork href="http://avalon.apache.org/framework/">Apache Avalon Framework</fork>
  163. for more information.
  164. </p>
  165. <p>
  166. Per default FOP uses the SimpleLog which logs to System.out. If you want to do logging using a
  167. logging framework (such as LogKit, Log4J or JDK 1.4 Logging) you can set a
  168. different Logger implementation on the Driver object. Here's an example how you would use LogKit:
  169. </p>
  170. <source><![CDATA[
  171. Hierarchy hierarchy = Hierarchy.getDefaultHierarchy();
  172. PatternFormatter formatter = new PatternFormatter(
  173. "[%{priority}]: %{message}\n%{throwable}" );
  174. LogTarget target = null;
  175. target = new StreamTarget(System.out, formatter);
  176. hierarchy.setDefaultLogTarget(target);
  177. log = hierarchy.getLoggerFor("fop");
  178. log.setPriority(Priority.INFO);
  179. driver.setLogger(new org.apache.avalon.framework.logger.LogKitLogger(log));]]></source>
  180. <p>
  181. The LogKitLogger class implements the Logger interface so all logging calls are being redirected to LogKit.
  182. More information on Jakarta LogKit can be found <fork href="http://jakarta.apache.org/avalon/logkit/index.html">here</fork>.
  183. </p>
  184. <p>
  185. Similar implementations exist for Log4J (org.apache.avalon.framework.logger.Log4JLogger) and
  186. JDK 1.4 logging (org.apache.avalon.framework.logger.Jdk14Logger).
  187. </p>
  188. <p>
  189. If you want FOP to be totally silent you can also set an org.apache.avalon.framework.logger.NullLogger instance.
  190. </p>
  191. <p>
  192. If you want to use yet another logging facility you simply have to create a class that
  193. implements org.apache.avalon.framework.logging.Logger and set it on the Driver object.
  194. See the existing implementations in Avalon Framework for examples.
  195. </p>
  196. </section>
  197. <section id="input">
  198. <title>Input Sources</title>
  199. <p>
  200. The input XSL-FO document is always handled internally as SAX (see the
  201. <link href="../dev/design/parsing.html">Parsing Design Document</link> for the rationale).
  202. However, the input itself can be provided in a variety of ways to FOP,
  203. which normalizes the input (if necessary) into SAX events:
  204. </p>
  205. <ul>
  206. <li><strong>SAX Events through SAX Handler</strong>: <code>FOTreeBuilder</code> is the SAX Handler which is obtained through <code>getContentHandler</code> on <code>Driver</code>.</li>
  207. <li><strong>DOM (which is converted into SAX Events)</strong>: The conversion of a DOM tree is done via the <code>render(Document)</code> method on <code>Driver</code>.</li>
  208. <li><strong>Data Source (which is parsed and converted into SAX Events)</strong>: The <code>Driver</code> can take an <code>InputSource</code> as input.
  209. This can use a <code>Stream</code>, <code>String</code> etc.</li>
  210. <li><strong>XML+XSLT Transformation</strong> (which is transformed using an XSLT Processor and the result is fired as SAX Events: <code>XSLTInputHandler</code> is used as an <code>InputSource</code> in the render(<code>XMLReader</code>, <code>InputSource</code>) method on <code>Driver</code>.</li>
  211. </ul>
  212. <p>
  213. There are a variety of upstream data manipulations possible.
  214. For example, you may have a DOM and an XSL stylesheet; or you may want to
  215. set variables in the stylesheet. Interface documentation and some cookbook
  216. solutions to these situations are provided in
  217. <fork href="http://xml.apache.org/xalan-j/usagepatterns.html">Xalan Basic Usage Patterns</fork>.
  218. </p>
  219. <p>
  220. See the <link href="#examples">Examples</link> for some variations on input.
  221. </p>
  222. </section>
  223. <section id="config-external">
  224. <title>Using a Configuration File</title>
  225. <p>
  226. To access an external configuration:
  227. </p>
  228. <source><![CDATA[
  229. import org.apache.fop.apps.Options;
  230. /*..*/
  231. userConfigFile = new File(userConfig);
  232. options = new Options(userConfigFile);]]></source>
  233. <note>
  234. This is all you need to do, it sets up a static configuration class.
  235. </note>
  236. <p>
  237. No further reference to the <code>options</code> variable is necessary.
  238. The "options = " is actually not even necessary.
  239. </p>
  240. <p>
  241. See <link href="#multithreading">Multithreading FOP</link> for issues related to changing configuration in a multithreaded environment.
  242. </p>
  243. </section>
  244. <section id="config-internal">
  245. <title>Setting the Configuration Programmatically</title>
  246. <p>
  247. If you wish to set configuration options from within your embedded application, use the <code>Configuration.put</code> method. Here is an example that sets the "baseDir" configuration in a Unix environment:
  248. </p>
  249. <source>org.apache.fop.configuration.Configuration.put("baseDir","/my/base/dir");</source>
  250. <p>
  251. Here is another that sets baseDir in a Windows environment:
  252. </p>
  253. <source>org.apache.fop.configuration.Configuration.put("baseDir","C:\my\base\dir");</source>
  254. <p>
  255. See <link href="#multithreading">Multithreading FOP</link> for issues related to changing configuration in a multithreaded environment.
  256. </p>
  257. </section>
  258. <section id="hints">
  259. <title>Hints</title>
  260. <section id="object-reuse">
  261. <title>Object reuse</title>
  262. <p>
  263. If FOP is going to be used multiple times within your application
  264. it may be useful to reuse certain objects to save time.
  265. </p>
  266. <p>
  267. The renderers and the driver can both be reused. A renderer is reusable
  268. once the previous render has been completed. The driver is reuseable
  269. after the rendering is complete and the <code>reset()</code> method is called.
  270. You will need to setup the driver again with a new OutputStream,
  271. IntputStream and renderer.
  272. </p>
  273. </section>
  274. <section id="awt">
  275. <title>AWT issues</title>
  276. <p>
  277. If your XSL-FO files contain SVG then Batik will be used. When Batik is
  278. initialised it uses certain classes in <code>java.awt</code> that
  279. intialises the java AWT classes. This means that a daemon thread
  280. is created by the JVM and on Unix it will need to connect to a
  281. DISPLAY.
  282. </p>
  283. <p>
  284. The thread means that the Java application may not automatically quit
  285. when finished, you will need to call <code>System.exit()</code>. These
  286. issues should be fixed in the upcoming JDK 1.4.
  287. </p>
  288. <p>
  289. If you run into trouble running FOP on a head-less server, please see the
  290. <link href="graphics.html#batik">notes on Batik</link>.
  291. </p>
  292. </section>
  293. <section id="render-info">
  294. <title>Getting information on the rendering process</title>
  295. <p>
  296. To get the number of pages that were rendered by FOP you can call
  297. <code>Driver.getResults()</code>. This returns a FormattingResults object
  298. where you can lookup the number of pages produced. It also gives you the
  299. page-sequences that were produced along with their id attribute and their
  300. number of pages. This is particularly useful if you render multiple
  301. documents (each enclosed by a page-sequence) and have to know the number of
  302. pages of each document.
  303. </p>
  304. </section>
  305. </section>
  306. <section id="performance">
  307. <title>Improving performance</title>
  308. <p>
  309. There are several options to consider:
  310. </p>
  311. <ul>
  312. <li>
  313. Whenever possible, try to use SAX to couple the individual components involved
  314. (parser, XSL transformer, SQL datasource etc.).
  315. </li>
  316. <li>
  317. Depending on the target OutputStream (in case of an FileOutputStream, but not
  318. for a ByteArrayOutputStream, for example) it may improve performance considerably
  319. if you buffer the OutputStream using a BufferedOutputStream:
  320. <code>driver.setOutputStream(new java.io.BufferedOutputStream(out));</code>
  321. <br/>
  322. Make sure you properly close the OutputStream when FOP is finished.
  323. </li>
  324. <li>
  325. Cache the stylesheet. If you use the same stylesheet multiple times
  326. you can setup a JAXP <code>Templates</code> object and reuse it each time you do
  327. the XSL transformation. (More information can be found
  328. <fork href="http://www.javaworld.com/javaworld/jw-05-2003/jw-0502-xsl.html">here</fork>.)
  329. </li>
  330. <li>
  331. Use an XSLT compiler like <fork href="http://xml.apache.org/xalan-j/xsltc_usage.html">XSLTC</fork>
  332. that comes with Xalan-J.
  333. </li>
  334. </ul>
  335. </section>
  336. <section id="multithreading">
  337. <title>Multithreading FOP</title>
  338. <p>
  339. FOP is not currently completely thread safe.
  340. Although the relevant methods of the Driver object are synchronized, FOP uses static
  341. variables for configuration data and loading images.
  342. Here are some tips to mitigate these problems:
  343. </p>
  344. <ul>
  345. <li>
  346. To avoid having your threads blocked, create a Driver object for each thread.
  347. </li>
  348. <li>
  349. If possible, do not change the configuration data while there is a Driver object rendering.
  350. Setup the configuration only once, preferably in the <code>init()</code> method of the servlet.
  351. </li>
  352. <li>
  353. If you must change the configuration data more often, or if you have multiple
  354. servlets within the same webapp using FOP, consider implementing a singleton
  355. class to encapsulate the configuration settings and to run FOP in synchronized methods.
  356. </li>
  357. </ul>
  358. <p>There is also a known issue with fonts being jumbled between threads when using the AWT renderer (which is used by the -awt and -print output options).
  359. In general, you cannot safely run multiple threads through the AWT renderer.</p>
  360. </section>
  361. <section id="examples">
  362. <title>Examples</title>
  363. <p>
  364. The directory "{fop-dir}/examples/embedding" contains several working examples.
  365. In contrast to the examples above the examples here primarily use JAXP for
  366. XML access. This may be easier to understand for people familiar with JAXP.
  367. </p>
  368. <section id="ExampleFO2PDF">
  369. <title>ExampleFO2PDF.java</title>
  370. <p>This example
  371. <fork href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/tags/fop-0_20_5/examples/embedding/java/embedding/ExampleFO2PDF.java?view=markup">
  372. (current 0.20.5)</fork>
  373. <fork href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleFO2PDF.java?view=markup">
  374. (future 1.0dev)</fork>
  375. demonstrates the basic usage pattern to transform an XSL-FO
  376. file to PDF using FOP.
  377. </p>
  378. <figure src="images/EmbeddingExampleFO2PDF.png" alt="Example XSL-FO to PDF"/>
  379. </section>
  380. <section id="ExampleXML2FO">
  381. <title>ExampleXML2FO.java</title>
  382. <p>This example
  383. <fork href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/tags/fop-0_20_5/examples/embedding/java/embedding/ExampleXML2FO.java?view=markup">
  384. (current 0.20.5)</fork>
  385. <fork href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleXML2FO.java?view=markup">
  386. (future 1.0dev)</fork>
  387. has nothing to do with FOP. It is there to show you how an XML
  388. file can be converted to XSL-FO using XSLT. The JAXP API is used to do the
  389. transformation. Make sure you've got a JAXP-compliant XSLT processor in your
  390. classpath (ex. <fork href="http://xml.apache.org/xalan-j">Xalan</fork>).
  391. </p>
  392. <figure src="images/EmbeddingExampleXML2FO.png" alt="Example XML to XSL-FO"/>
  393. </section>
  394. <section id="ExampleXML2PDF">
  395. <title>ExampleXML2PDF.java</title>
  396. <p>This example
  397. <fork href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/tags/fop-0_20_5/examples/embedding/java/embedding/ExampleXML2PDF.java?view=markup">
  398. (current 0.20.5)</fork>
  399. <fork href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleXML2PDF.java?view=markup">
  400. (future 1.0dev)</fork>
  401. demonstrates how you can convert an arbitrary XML file to PDF
  402. using XSLT and XSL-FO/FOP. It is a combination of the first two examples
  403. above. The example uses JAXP to transform the XML file to XSL-FO and FOP to
  404. transform the XSL-FO to PDF.
  405. </p>
  406. <figure src="images/EmbeddingExampleXML2PDF.png" alt="Example XML to PDF (via XSL-FO)"/>
  407. <p>
  408. The output (XSL-FO) from the XSL transformation is piped through to FOP using
  409. SAX events. This is the most efficient way to do this because the
  410. intermediate result doesn't have to be saved somewhere. Often, novice users
  411. save the intermediate result in a file, a byte array or a DOM tree. We
  412. strongly discourage you to do this if it isn't absolutely necessary. The
  413. performance is significantly higher with SAX.
  414. </p>
  415. </section>
  416. <section id="ExampleObj2XML">
  417. <title>ExampleObj2XML.java</title>
  418. <p>This example
  419. <fork href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/tags/fop-0_20_5/examples/embedding/java/embedding/ExampleObj2XML.java?view=markup">
  420. (current 0.20.5)</fork>
  421. <fork href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleObj2XML.java?view=markup">
  422. (future 1.0dev)</fork>
  423. is a preparatory example for the next one. It's an example that
  424. shows how an arbitrary Java object can be converted to XML. It's an often
  425. needed task to do this. Often people create a DOM tree from a Java object and
  426. use that. This is pretty straightforward. The example here however shows how
  427. to do this using SAX which will probably be faster and not even more
  428. complicated once you know how this works.
  429. </p>
  430. <figure src="images/EmbeddingExampleObj2XML.png" alt="Example Java object to XML"/>
  431. <p>
  432. For this example we've created two classes: ProjectTeam and ProjectMember
  433. (found in xml-fop/examples/embedding/java/embedding/model). They represent
  434. the same data structure found in
  435. xml-fop/examples/embedding/xml/xml/projectteam.xml. We want to serialize a
  436. project team with several members which exist as Java objects to XML.
  437. Therefore we created the two classes: ProjectTeamInputSource and
  438. ProjectTeamXMLReader (in the same place as ProjectTeam above).
  439. </p>
  440. <p>
  441. The XMLReader implementation (regard it as a special kind of XML parser)is
  442. responsible for creating SAX events from the Java object. The InputSource
  443. class is only used to hold the ProjectTeam object to be used.
  444. </p>
  445. <p>
  446. Have a look at the source of ExampleObj2XML.java to find out how this is
  447. used. For more detailed information see other resources on JAXP (ex.
  448. <fork href="http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/xslt/3_generate.html">An older JAXP tutorial</fork>).
  449. </p>
  450. </section>
  451. <section id="ExampleObj2PDF">
  452. <title>ExampleObj2PDF.java</title>
  453. <p>This example
  454. <fork href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/tags/fop-0_20_5/examples/embedding/java/embedding/ExampleObj2PDF.java?view=markup">
  455. (current 0.20.5)</fork>
  456. <fork href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleObj2PDF.java?view=markup">
  457. (future 1.0dev)</fork>
  458. combines the previous and the third to demonstrate
  459. how you can transform a Java object to a PDF directly in one smooth run
  460. by generating SAX events from the Java object that get fed to an XSL
  461. transformation. The result of the transformation is then converted to PDF
  462. using FOP as before.
  463. </p>
  464. <figure src="images/EmbeddingExampleObj2PDF.png" alt="Example Java object to PDF (via XML and XSL-FO)"/>
  465. </section>
  466. <section id="ExampleDOM2PDF">
  467. <title>ExampleDOM2PDF.java</title>
  468. <p>This example
  469. <fork href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/tags/fop-0_20_5/examples/embedding/java/embedding/ExampleDOM2PDF.java?view=markup">
  470. (current 0.20.5)</fork>
  471. <fork href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleDOM2PDF.java?view=markup">
  472. (future 1.0dev)</fork>
  473. has FOP use a DOMSource instead of a StreamSource in order to
  474. use a DOM tree as input for an XSL transformation.
  475. </p>
  476. </section>
  477. <section id="ExampleSVG2PDF">
  478. <title>ExampleSVG2PDF.java (PDF Transcoder example)</title>
  479. <p>This example
  480. <fork href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleSVG2PDF.java?view=markup">
  481. (applies to 0.20.5 and future 1.0dev)</fork>
  482. shows use of the PDF Transcoder, a sub-application within FOP.
  483. It is used to generate a PDF document from an SVG file.
  484. </p>
  485. </section>
  486. <section id="example-notes">
  487. <title>Final notes</title>
  488. <p>
  489. These examples should give you an idea of what's possible. It should be easy
  490. to adjust these examples to your needs. Also, if you have other examples that you
  491. think should be added here, please let us know via either the FOP-USER or FOP-DEV
  492. mailing lists. Finally, for more help please send your questions to the FOP-USER
  493. mailing list.
  494. </p>
  495. </section>
  496. </section>
  497. </body>
  498. </document>