From: Jeremias Maerki
- To embed Apache FOP in your application, instantiate org.apache.fop.apps.Fop. - You'll tell FOP in the constructor which output format (i.e. Renderer) to use. - Afterwards, you'll set the OutputStream to use to output the results of the - rendering (where applicable). You can customize FOP's behaviour by supplying + To embed Apache FOP in your application, instantiate a new org.apache.fop.apps.FopFactory + instance and create a new org.apache.fop.apps.Fop instance through one of the factory + methods of FopFactory. There, you can specify which output format (i.e. Renderer) to use + and you can optionally set the OutputStream to use to output the results of the + rendering. You can customize FOP's behaviour by supplying your own FOUserAgent instance. The FOUserAgent can, for example, be used to set your own Renderer instance (details below). Finally, you retrieve a SAX DefaultHandler instance from the Fop instance to which you can send your FO file.
+Here is the basic pattern to render an XSL-FO file to PDF:
+fopFactory.setUserConfig(cfg); + +/* ..or.. */ + +fopFactory.setUserConfig(new File("C:/Temp/mycfg.xml"));]]>The layout of the configuration file is described on the Configuration page.
@@ -414,11 +466,10 @@ userAgent.setUserConfig(cfg);]]>- At the moment, the Fop instances shouldn't be reused. Please recreate - Fop and FOUserAgent instances for each rendering run until further notice. - We will likely add an additional object which will carry information - and configuration which can be reused between rendering runs to further - optimize this. + Fop instances shouldn't (and can't) be reused. Please recreate + Fop and FOUserAgent instances for each rendering run using the FopFactory. + This is a cheap operation as all reusable information is held in the + FopFactory. That's why it's so important to reuse the FopFactory instance.
Apache FOP may currently not be completely thread safe. - FOP uses some static variables (for example for the image cache). This code - has not been fully tested for multi-threading issues, yet. + The code has not been fully tested for multi-threading issues, yet. + If you encounter any suspicious behaviour, please notify us.
There is also a known issue with fonts being jumbled between threads when using diff --git a/src/documentation/content/xdocs/trunk/intermediate.xml b/src/documentation/content/xdocs/trunk/intermediate.xml index 360766241..ad42f2645 100644 --- a/src/documentation/content/xdocs/trunk/intermediate.xml +++ b/src/documentation/content/xdocs/trunk/intermediate.xml @@ -69,13 +69,15 @@ The basic pattern to parse the IF format looks like this: