You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by ss...@apache.org on 2020/05/13 09:41:32 UTC

svn commit: r1877686 [2/5] - in /xmlgraphics/site/trunk: content/batik/ content/fop/ content/fop/2.5/ content/fop/2.5/images/ lib/ templates/

Added: xmlgraphics/site/trunk/content/fop/2.5/embedding.mdtext
URL: http://svn.apache.org/viewvc/xmlgraphics/site/trunk/content/fop/2.5/embedding.mdtext?rev=1877686&view=auto
==============================================================================
--- xmlgraphics/site/trunk/content/fop/2.5/embedding.mdtext (added)
+++ xmlgraphics/site/trunk/content/fop/2.5/embedding.mdtext Wed May 13 09:41:31 2020
@@ -0,0 +1,407 @@
+Title: Apache(tm) FOP: Embedding
+
+#Apache™ FOP: Embedding
+<subtitle>How to Embed FOP in a Java application</subtitle>
+
+## Overview { #overview}
+
+Review [Running Apache&trade; FOP](running.html) for important information that applies to embedded applications as well as command-line use, such as options and performance.
+
+To embed Apache&trade; FOP in your application, first create a new org.apache.fop.apps.FopFactory instance. This object can be used to launch multiple rendering runs. For each run, create a new org.apache.fop.apps.Fop instance through one of the factory methods of FopFactory. In the method call you specify which output format (i.e. MIME type) to use and, if the selected output format requires an OutputStream, which OutputStream to use for the results of the rendering. You can customize FOP's behaviour in a rendering run by supplying your own FOUserAgent instance. The FOUserAgent can, for example, be used to set your own document handler instance (details below). Finally, you retrieve a SAX DefaultHandler instance from the Fop object and use that as the SAXResult of your transformation.
+
+## The API { #API}
+
+FOP has many classes which express the "public" access modifier, however, this is not indicative of their inclusion into the public API. Every attempt will be made to keep the public API static, to minimize regressions for existing users, however, since the API is not clearly defined, the list of classes below are the generally agreed public API:
+
+ - org.apache.fop.apps.*
+ - org.apache.fop.fo.FOEventHandler
+ - org.apache.fop.fo.ElementMappingRegistry
+ - org.apache.fop.fonts.FontManager
+ - org.apache.fop.events.EventListener
+ - org.apache.fop.events.Event
+ - org.apache.fop.events.model.EventSeverity
+ - org.apache.fop.render.ImageHandlerRegistry
+ - org.apache.fop.render.RendererFactory
+ - org.apache.fop.render.intermediate.IFContext
+ - org.apache.fop.render.intermediate.IFDocumentHandler
+ - org.apache.fop.render.intermediate.IFException
+ - org.apache.fop.render.intermediate.IFParser
+ - org.apache.fop.render.intermediate.IFSerializer
+ - org.apache.fop.render.intermediate.IFUtil
+ - org.apache.fop.render.intermediate.util.IFConcatenator
+
+## Basic Usage Pattern { #basics}
+
+Apache FOP relies heavily on JAXP. It uses SAX events exclusively to receive the XSL-FO input document. It is therefore a good idea that you know a few things about JAXP (which is a good skill anyway). Let's look at the basic usage pattern for FOP...
+
+Here is the basic pattern to render an XSL-FO file to PDF:
+
+    :::java
+    import org.apache.fop.apps.FopFactory;
+    import org.apache.fop.apps.Fop;
+    import org.apache.fop.apps.MimeConstants;
+
+    /*..*/
+
+    // Step 1: Construct a FopFactory by specifying a reference to the configuration file
+    // (reuse if you plan to render multiple documents!)
+    FopFactory fopFactory = FopFactory.newInstance(new File("C:/Temp/fop.xconf"));
+
+    // Step 2: Set up output stream.
+    // Note: Using BufferedOutputStream for performance reasons (helpful with FileOutputStreams).
+    OutputStream out = new BufferedOutputStream(new FileOutputStream(new File("C:/Temp/myfile.pdf")));
+
+    try {
+        // Step 3: Construct fop with desired output format
+        Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out);
+
+        // Step 4: Setup JAXP using identity transformer
+        TransformerFactory factory = TransformerFactory.newInstance();
+        Transformer transformer = factory.newTransformer(); // identity transformer
+
+        // Step 5: Setup input and output for XSLT transformation
+        // Setup input stream
+        Source src = new StreamSource(new File("C:/Temp/myfile.fo"));
+
+        // Resulting SAX events (the generated FO) must be piped through to FOP
+        Result res = new SAXResult(fop.getDefaultHandler());
+
+        // Step 6: Start XSLT transformation and FOP processing
+        transformer.transform(src, res);
+
+    } finally {
+        //Clean-up
+        out.close();
+    }
+
+Let's discuss these 5 steps in detail:
+
+
+-  **Step 1:** You create a new FopFactory instance. The FopFactory is created and holds references to configuration information and cached data. It's important to reuse this instance if you plan to render multiple documents during a JVM's lifetime.
+
+-  **Step 2:** You set up an OutputStream that the generated document will be written to. It's a good idea to buffer the OutputStream as demonstrated to improve performance.
+
+-  **Step 3:** You create a new Fop instance through one of the factory methods on the FopFactory. You tell the FopFactory what your desired output format is. This is done by using the MIME type of the desired output format (ex. "application/pdf"). You can use one of the MimeConstants.* constants. The second parameter is the OutputStream you've setup up in step 2.
+
+-  **Step 4** We recommend that you use JAXP Transformers even if you don't do XSLT transformations to generate the XSL-FO file. This way you can always use the same basic pattern. The example here sets up an "identity transformer" which just passes the input (Source) unchanged to the output (Result). You don't have to work with a SAXParser if you don't do any XSLT transformations.
+
+-  **Step 5:** Here you set up the input and output for the XSLT transformation. The Source object is set up to load the "myfile.fo" file. The Result is set up so the output of the XSLT transformation is sent to FOP. The FO file is sent to FOP in the form of SAX events which is the most efficient way. Please always avoid saving intermediate results to a file or a memory buffer because that affects performance negatively.
+
+-  **Step 6:** Finally, we start the XSLT transformation by starting the JAXP Transformer. As soon as the JAXP Transformer starts to send its output to FOP, FOP itself starts its processing in the background. When the `transform()` method returns FOP will also have finished converting the FO file to a PDF file and you can close the OutputStream.
+
+    <note label="Tip!">It's a good idea to enclose the whole conversion in a try..finally statement. If you close the OutputStream in the finally section, this will make sure that the OutputStream is properly closed even if an exception occurs during the conversion.</note>
+
+If you're not totally familiar with JAXP Transformers, please have a look at the [Embedding examples](#examples) below. The section contains examples for all sorts of use cases. If you look at all of them in turn you should be able to see the patterns in use and the flexibility this approach offers without adding too much complexity.
+
+This may look complicated at first, but it's really just the combination of an XSL transformation and a FOP run. It's also easy to comment out the FOP part for debugging purposes, for example when you're tracking down a bug in your stylesheet. You can easily write the XSL-FO output from the XSL transformation to a file to check if that part generates the expected output. An example for that can be found in the [Embedding examples](#examples) (See "ExampleXML2FO").
+
+### Logging { #basic-logging}
+
+Logging is now a little different than it was in FOP 0.20.5. We've switched from Avalon Logging to [Jakarta Commons Logging](http://commons.apache.org/logging/). While with Avalon Logging the loggers were directly given to FOP, FOP now retrieves its logger(s) through a statically available LogFactory. This is similar to the general pattern that you use when you work with Apache Log4J directly, for example. We call this "static logging" (Commons Logging, Log4J) as opposed to "instance logging" (Avalon Logging). This has a consequence: You can't give FOP a logger for each processing run anymore. The log output of multiple, simultaneously running FOP instances is sent to the same logger.
+
+By default, [Jakarta Commons Logging](http://commons.apache.org/logging/) uses JDK logging (available in JDKs 1.4 or higher) as its backend. You can configure Commons Logging to use an alternative backend, for example Log4J. Please consult the [documentation for Jakarta Commons Logging](http://commons.apache.org/logging/) on how to configure alternative backends.
+
+As a result of the above we differentiate between two kinds of "logging":
+
+
+- (FOP-)Developer-oriented logging
+
+-  [User/Integrator-oriented feedback](events.html) (NEW!)
+
+The use of "feedback" instead of "logging" is intentional. Most people were using log output as a means to get feedback from events within FOP. Therefore, FOP now includes an `event` package which can be used to receive feedback from the layout engine and other components within FOP **per rendering run**. This feedback is not just some text but event objects with parameters so these events can be interpreted by code. Of course, there is a facility to turn these events into normal human-readable messages. For details, please read on on the [Events page](events.html). This leaves normal logging to be mostly a thing used by the FOP developers although anyone can surely activate certain logging categories but the feedback from the loggers won't be separated by processing runs. If this is required, the [Events subsystem](events.html) is the right approach.
+
+### Processing XSL-FO { #render}
+
+Once the Fop instance is set up, call `getDefaultHandler()` to obtain a SAX DefaultHandler instance to which you can send the SAX events making up the XSL-FO document you'd like to render. FOP processing starts as soon as the DefaultHandler's `startDocument()` method is called. Processing stops again when the DefaultHandler's `endDocument()` method is called. Please refer to the basic usage pattern shown above to render a simple XSL-FO document.
+
+### Processing XSL-FO generated from XML+XSLT { #render-with-xslt}
+
+If you want to process XSL-FO generated from XML using XSLT we recommend again using standard JAXP to do the XSLT part and piping the generated SAX events directly through to FOP. The only thing you'd change to do that on the basic usage pattern above is to set up the Transformer differently:
+
+    :::java
+    //without XSLT:
+    //Transformer transformer = factory.newTransformer(); // identity transformer
+
+    //with XSLT:
+    Source xslt = new StreamSource(new File("mystylesheet.xsl"));
+    Transformer transformer = factory.newTransformer(xslt);
+
+## Input Sources { #input}
+
+The input XSL-FO document is always received by FOP as a SAX stream (see the [Parsing Design Document](../dev/design/parsing.html) for the rationale).
+
+However, you may not always have your input document available as a SAX stream. But with JAXP it's easy to convert different input sources to a SAX stream so you can pipe it into FOP. That sounds more difficult than it is. You simply have to set up the right Source instance as input for the JAXP transformation. A few examples:
+
+
+-  **URL:**
+
+        :::java
+        Source src = new StreamSource("http://localhost:8080/testfile.xml");
+
+-  **File:**
+
+        :::java
+        Source src = new StreamSource(new File("C:/Temp/myinputfile.xml"));
+
+-  **String:**
+
+        :::java
+        Source src = new StreamSource(new StringReader(myString)); // myString is a String
+
+-  **InputStream:**
+
+        :::java
+        Source src = new StreamSource(new MyInputStream(something));
+
+-  **Byte Array:**
+
+        :::java
+        Source src = new StreamSource(new ByteArrayInputStream(myBuffer)); // myBuffer is a byte[] here
+
+-  **DOM:**
+
+        :::java
+        Source src = new DOMSource(myDocument); // myDocument is a Document or a Node
+
+-  **Java Objects:** Please have a look at the [Embedding examples](#examples) which contain an example for this.
+
+There are a variety of upstream data manipulations possible. For example, you may have a DOM and an XSL stylesheet; or you may want to set variables in the stylesheet. Interface documentation and some cookbook solutions to these situations are provided in [Xalan Basic Usage Patterns](http://xml.apache.org/xalan-j/usagepatterns.html).
+
+## Configuring Apache FOP Programmatically { #config-internal}
+
+Apache FOP provides two levels on which you can customize FOP's behaviour: the FopFactory and the user agent.
+
+### Customizing the FopFactory { #fop-factory}
+
+The FopFactory holds configuration data and references to objects which are reusable over multiple rendering runs. It's important to instantiate it only once (except in special environments) and reuse it every time to create new FOUserAgent and Fop instances.
+
+The FopFactoryBuilder is used to construct a FopFactory object. This builder can be used to set configuration values which will determine the behaviour of the FopFactory object. To create the FopFactoryBuilder the following line can be used as a precursor for the following examples:
+
+    :::java
+    FopFactoryBuilder builder = new FopFactoryBuilder(baseURI);
+
+Set a **URIResolver** for custom URI resolution. By supplying a JAXP URIResolver you can add custom URI resolution functionality to FOP. For example:
+
+    :::java
+    // myResourceResolver is a org.apache.xmlgraphics.io.ResourceResolver
+    FopFactoryBuilder builder = new FopFactoryBuilder(baseURI, myResourceResolver);
+
+- Disable **strict validation**. When disabled FOP is less strict about the rules established by the XSL-FO specification. Example:
+
+        :::java
+        builder.setStrictFOValidation(false);
+
+- Enable an **alternative set of rules for text indents** that tries to mimic the behaviour of many commercial FO implementations, that chose to break the specification in this respect. The default of this option is 'false', which causes Apache FOP to behave exactly as described in the specification. To enable the alternative behaviour, call:
+
+        :::java
+        builder.setBreakIndentInheritanceOnReferenceAreaBoundary(true);
+
+- Set the **source resolution** for the document. This is used internally to determine the pixel size for SVG images and bitmap images without resolution information. Default: 72 dpi. Example:
+
+        :::java
+        builder.setSourceResolution(96); // =96dpi (dots/pixels per Inch)
+
+The following example shows how a FopFactory is created using the settings specified:
+
+    :::java
+    FopFactory fopFactory = builder.build();
+
+Finally, there are several options which can be set on the FopFactory itself including the following example:
+
+- Manually add an **ElementMapping instance**. If you want to supply a special FOP extension you can give the instance to the FOUserAgent. Normally, the FOP extensions can be automatically detected (see the documentation on extension for more info). Example:
+
+        :::java
+        fopFactory.addElementMapping(myElementMapping); // myElementMapping is a org.apache.fop.fo.ElementMapping
+
+### Customizing the User Agent { #user-agent}
+
+The user agent is the entity that allows you to interact with a single rendering run, i.e. the processing of a single document. If you wish to customize the user agent's behaviour, the first step is to create your own instance of FOUserAgent using the appropriate factory method on FopFactory and pass that to the factory method that will create a new Fop instance:
+
+    :::java
+    FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI()); // Reuse the FopFactory if possible!
+    // do the following for each new rendering run
+    FOUserAgent userAgent = fopFactory.newFOUserAgent();
+    // customize userAgent
+    Fop fop = fopFactory.newFop(MimeConstants.MIME_POSTSCRIPT, userAgent, out);
+
+You can do all sorts of things on the user agent:
+
+- Set the **producer** of the document. This is metadata information that can be used for certain output formats such as PDF. The default producer is "Apache FOP". Example:
+
+        :::java
+        userAgent.setProducer("MyKillerApplication");
+
+- Set the **creating user** of the document. This is metadata information that can be used for certain output formats such as PDF. Example:
+
+        :::java
+        userAgent.setCreator("John Doe");
+
+- Set the **author** of the document. This is metadata information that can be used for certain output formats such as PDF. Example:
+
+        :::java
+        userAgent.setAuthor("John Doe");
+
+- Override the **creation date and time** of the document. This is metadata information that can be used for certain output formats such as PDF. Example:
+
+        :::java
+        userAgent.setCreationDate(new Date());
+
+- Set the **title** of the document. This is metadata information that can be used for certain output formats such as PDF. Example:
+
+        :::java
+        userAgent.setTitle("Invoice No 138716847");
+
+- Set the **keywords** of the document. This is metadata information that can be used for certain output formats such as PDF. Example:
+
+        :::java
+        userAgent.setKeywords("XML XSL-FO");
+
+- Set the **target resolution** for the document. This is used to specify the output resolution for bitmap images generated by bitmap renderers (such as the TIFF renderer) and by bitmaps generated by Apache Batik for filter effects and such. Default: 72 dpi. Example:
+
+        :::java
+        userAgent.setTargetResolution(300); // =300dpi (dots/pixels per Inch)
+
+- Set **your own Document Handler**. This feature can be used for several purposes, the most likey usage of which would probably be binding a MIME type when the output is Intermediate Format (see [Document Handlers](#documenthandlers)). This also allows advanced users to create their own implementation of the document handler.
+
+        :::java
+        userAgent.setDocumentHandlerOverride(documentHandler); // documentHandler is an instance of org.apache.fop.render.intermediate.IFDocumentHandler
+
+- Set **your own FOEventHandler instance**. If you want to supply your own FOEventHandler or configure an FOEventHandler subclass in a special way you can give the instance to the FOUserAgent. Normally, the FOEventHandler instance is created by FOP. Example:
+
+        :::java
+        userAgent.setFOEventHandlerOverride(myFOEventHandler); // myFOEventHandler is an org.apache.fop.fo.FOEventHandler
+
+<note>You should not reuse an FOUserAgent instance between FOP rendering runs although you can. Especially in multi-threaded environment, this is a bad idea.</note>
+
+## Using a Configuration File { #config-external}
+
+Instead of setting the parameters manually in code as shown above you can also set many values from an XML configuration file:
+
+    :::java
+    import org.apache.avalon.framework.configuration.Configuration;
+    import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
+
+    /*..*/
+
+    DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
+    Configuration cfg = cfgBuilder.buildFromFile(new File("C:/Temp/mycfg.xml"));
+    fopFactoryBuilder = new FopFactoryBuilder(baseURI).setConfiguration(cfg);
+
+The layout of the configuration file is described on the [Configuration page](configuration.html).
+
+## Document Handlers { #documenthandlers}
+
+The document handlers are classes that inherit from `org.apache.fop.render.intermediate.IFDocumentHandler`. This is an interface for which a MIME type specific implementation can be created. This same handler is used either when XSL-FO is used as the input or when Intermediate Format is used. Since IF is output format agnostic, if custom fonts or other configuration information that affect layout (specific to a particular MIME type) are given then FOP needs that contextual information. The document handler provides that context so that when the IF is rendered, it is more visually consistent with FO rendering. The code below shows an example of how a document handler can be used to provide PDF configuration data to the IFSerializer.
+
+    :::java
+    IFDocumentHandler targetHandler = userAgent.getRendererFactory().createDocumentHandler(userAgent, MimeConstants.MIME_PDF);
+
+    IFSerializer ifSerializer = new IFSerializer(new IFContext(userAgent));  //Create the IFSerializer to write the intermediate format
+    ifSerializer.mimicDocumentHandler(targetHandler);   //Tell the IFSerializer to mimic the target format
+
+    userAgent.setDocumentHandlerOverride(ifSerializer);  //Make sure the prepared document handler is used
+
+The rest of the code is the same as in [Basic Usage Patterns](#basics).
+
+## Hints { #hints}
+
+### Object reuse { #object-reuse}
+
+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.
+
+### AWT issues { #awt}
+
+If your XSL-FO files contain SVG then Apache Batik will be used. When Batik is initialised it uses certain classes in `java.awt` that intialise the Java AWT classes. This means that a daemon thread is created by the JVM and on Unix it will need to connect to a DISPLAY.
+
+The thread means that the Java application may not automatically quit when finished, you will need to call `System.exit()`. These issues should be fixed in the JDK 1.4.
+
+If you run into trouble running FOP on a head-less server, please see the [notes on Batik](graphics.html#batik).
+
+### Getting information on the rendering process { #render-info}
+
+To get the number of pages that were rendered by FOP you can call `Fop.getResults()`. This returns a `FormattingResults` object where you can look up the number of pages produced. It also gives you the page-sequences that were produced along with their id attribute and their numbers of pages. This is particularly useful if you render multiple documents (each enclosed by a page-sequence) and have to know the number of pages of each document.
+
+## Improving performance { #performance}
+
+There are several options to consider:
+
+- Whenever possible, try to use SAX to couple the individual components involved (parser, XSL transformer, SQL datasource etc.).
+
+- Depending on the target OutputStream (in case of a FileOutputStream, but not for a ByteArrayOutputStream, for example) it may improve performance considerably if you buffer the OutputStream using a BufferedOutputStream:
+
+        :::java
+        out = new java.io.BufferedOutputStream(out);
+
+    Make sure you properly close the OutputStream when FOP is finished.
+
+- Cache the stylesheet. If you use the same stylesheet multiple times you can set up a JAXP `Templates` object and reuse it each time you do the XSL transformation. (More information can be found [here](http://www.javaworld.com/javaworld/jw-05-2003/jw-0502-xsl.html).)
+
+- Use an XSLT compiler like [XSLTC](http://xml.apache.org/xalan-j/xsltc_usage.html) that comes with Xalan-J.
+
+- Fine-tune your stylesheet to make the XSLT process more efficient and to create XSL-FO that can be processed by FOP more efficiently. Less is more: Try to make use of property inheritance where possible.
+
+- You may also wish to consider trying to reduce [memory usage](running.html#memory).
+
+## Multithreading FOP { #multithreading}
+
+Apache FOP may currently not be completely thread safe. 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 the Java2D/AWT renderer (which is used by the -awt and -print output options). In general, you cannot safely run multiple threads through the AWT renderer.
+
+## Examples { #examples}
+
+The directory "{fop-dir}/examples/embedding" contains several working examples.
+
+### ExampleFO2PDF.java { #ExampleFO2PDF}
+
+This [example](http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/fop/examples/embedding/java/embedding/ExampleFO2PDF.java?view=markup) demonstrates the basic usage pattern to transform an XSL-FO file to PDF using FOP.
+
+![Example XSL-FO to PDF](images/EmbeddingExampleFO2PDF.png)
+
+### ExampleXML2FO.java { #ExampleXML2FO}
+
+This [example](http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/fop/examples/embedding/java/embedding/ExampleXML2FO.java?view=markup) has nothing to do with FOP. It is there to show you how an XML file can be converted to XSL-FO using XSLT. The JAXP API is used to do the transformation. Make sure you've got a JAXP-compliant XSLT processor in your classpath (ex. [Xalan](http://xml.apache.org/xalan-j)).
+
+![Example XML to XSL-FO](images/EmbeddingExampleXML2FO.png)
+
+### ExampleXML2PDF.java { #ExampleXML2PDF}
+
+This [example](http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/fop/examples/embedding/java/embedding/ExampleXML2PDF.java?view=markup) demonstrates how you can convert an arbitrary XML file to PDF using XSLT and XSL-FO/FOP. It is a combination of the first two examples above. The example uses JAXP to transform the XML file to XSL-FO and FOP to transform the XSL-FO to PDF.
+
+![Example XML to PDF (via XSL-FO)](images/EmbeddingExampleXML2PDF.png)
+
+The output (XSL-FO) from the XSL transformation is piped through to FOP using SAX events. This is the most efficient way to do this because the intermediate result doesn't have to be saved somewhere. Often, novice users save the intermediate result in a file, a byte array or a DOM tree. We strongly discourage you to do this if it isn't absolutely necessary. The performance is significantly higher with SAX.
+
+### ExampleObj2XML.java { #ExampleObj2XML}
+
+This [example](http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/fop/examples/embedding/java/embedding/ExampleObj2XML.java?view=markup) is a preparatory example for the next one. It's an example that shows how an arbitrary Java object can be converted to XML. It's an often needed task to do this. Often people create a DOM tree from a Java object and use that. This is pretty straightforward. The example here, however, shows how to do this using SAX, which will probably be faster and not even more complicated once you know how this works.
+
+![Example Java object to XML](images/EmbeddingExampleObj2XML.png)
+
+For this example we've created two classes: ProjectTeam and ProjectMember (found in xml-fop/examples/embedding/java/embedding/model). They represent the same data structure found in xml-fop/examples/embedding/xml/xml/projectteam.xml. We want to serialize to XML a project team with several members which exist as Java objects. Therefore we created the two classes: ProjectTeamInputSource and ProjectTeamXMLReader (in the same place as ProjectTeam above).
+
+The XMLReader implementation (regard it as a special kind of XML parser) is responsible for creating SAX events from the Java object. The InputSource class is only used to hold the ProjectTeam object to be used.
+
+Have a look at the source of ExampleObj2XML.java to find out how this is used. For more detailed information see other resources on JAXP (ex. [An older JAXP tutorial](http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/xslt/3_generate.html)).
+
+### ExampleObj2PDF.java { #ExampleObj2PDF}
+
+This [example](http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/fop/examples/embedding/java/embedding/ExampleObj2PDF.java?view=markup) combines the previous and the third to demonstrate how you can transform a Java object to a PDF directly in one smooth run by generating SAX events from the Java object that get fed to an XSL transformation. The result of the transformation is then converted to PDF using FOP as before.
+
+![Example Java object to PDF (via XML and XSL-FO)](images/EmbeddingExampleObj2PDF.png)
+
+### ExampleDOM2PDF.java { #ExampleDOM2PDF}
+
+This [example](http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/fop/examples/embedding/java/embedding/ExampleDOM2PDF.java?view=markup) has FOP use a DOMSource instead of a StreamSource in order to use a DOM tree as input for an XSL transformation.
+
+### ExampleSVG2PDF.java (PDF Transcoder example) { #ExampleSVG2PDF}
+
+This [example](http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/fop/examples/embedding/java/embedding/ExampleSVG2PDF.java?view=markup) shows the usage of the PDF Transcoder, a sub-application within FOP. It is used to generate a PDF document from an SVG file.
+
+### ExampleConcat.java (IF Concatenation example) { #ExampleConcat}
+
+This can be found in the `embedding.intermediate` package within the examples and describes how IF can be concatenated to produce a document. Because IF has been through FOPs layout engine, it should be visually consistent with FO rendered documents while allowing the user to merge numerous documents together.
+
+### Final notes { #example-notes}
+
+These examples should give you an idea of what's possible. It should be easy to adjust these examples to your needs. Also, if you have other examples that you think should be added here, please let us know via either the fop-users or fop-dev mailing lists. Finally, for more help please send your questions to the fop-users mailing list.

Propchange: xmlgraphics/site/trunk/content/fop/2.5/embedding.mdtext
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/site/trunk/content/fop/2.5/embedding.mdtext
------------------------------------------------------------------------------
    svn:executable = *

Added: xmlgraphics/site/trunk/content/fop/2.5/events.mdtext
URL: http://svn.apache.org/viewvc/xmlgraphics/site/trunk/content/fop/2.5/events.mdtext?rev=1877686&view=auto
==============================================================================
--- xmlgraphics/site/trunk/content/fop/2.5/events.mdtext (added)
+++ xmlgraphics/site/trunk/content/fop/2.5/events.mdtext Wed May 13 09:41:31 2020
@@ -0,0 +1,251 @@
+Title: Apache(tm) FOP: Events/Processing Feedback
+
+#Apache&trade; FOP: Events/Processing Feedback
+
+
+## Introduction { #introduction}
+
+In versions until 0.20.5, Apache&trade; FOP used [Avalon-style Logging](http://excalibur.apache.org/framework/index.html) where it was possible to supply a logger per processing run. During the redesign the logging infrastructure was switched over to [Commons Logging](http://commons.apache.org/logging/) which is (like Log4J or java.util.logging) a "static" logging framework (the logger is accessed through static variables). This made it very difficult in a multi-threaded system to retrieve information for a single processing run.
+
+With FOP's event subsystem, we'd like to close this gap again and even go further. The first point is to realize that we have two kinds of "logging". Firstly, we have the logging infrastructure for the (FOP) developer who needs to be able to enable finer log messages for certain parts of FOP to track down a certain problem. Secondly, we have the user who would like to be informed about missing images, overflowing lines or substituted fonts. These messages (or events) are targeted at less technical people and may ideally be localized (translated). Furthermore, tool and solution builders would like to integrate FOP into their own solutions. For example, an FO editor should be able to point the user to the right place where a particular problem occurred while developing a document template. Finally, some integrators would like to abort processing if a resource (an image or a font) has not been found, while others would simply continue. The event system allows to react on these events.
+
+On this page, we won't discuss logging as such. We will show how the event subsystem can be used for various tasks. We'll first look at the event subsystem from the consumer side. Finally, the production of events inside FOP will be discussed (this is mostly interesting for FOP developers only).
+
+## The consumer side { #consumer}
+
+The event subsystem is located in the `org.apache.fop.events` package and its base is the `Event` class. An instance is created for each event and is sent to a set of `EventListener` instances by the `EventBroadcaster`. An `Event` contains:
+
+
+- an event ID,
+
+- a source object (which generated the event),
+
+- a severity level (Info, Warning, Error and Fatal Error) and
+
+- a map of named parameters.
+
+The `EventFormatter` class can be used to translate the events into human-readable, localized messages.
+
+A full example of what is shown here can be found in the `examples/embedding/java/embedding/events` directory in the FOP distribution. The example can also be accessed [via the web](http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop/examples/embedding/java/embedding/events/).
+
+### Writing an EventListener { #write-listener}
+
+The following code sample shows a very simple EventListener. It basically just sends all events to System.out (stdout) or System.err (stderr) depending on the event severity.
+
+    :::java
+    import org.apache.fop.events.Event;
+    import org.apache.fop.events.EventFormatter;
+    import org.apache.fop.events.EventListener;
+    import org.apache.fop.events.model.EventSeverity;
+
+    /** A simple event listener that writes the events to stdout and stderr. */
+    public class SysOutEventListener implements EventListener {
+
+        /** {@inheritDoc} */
+        public void processEvent(Event event) {
+            String msg = EventFormatter.format(event);
+            EventSeverity severity = event.getSeverity();
+            if (severity == EventSeverity.INFO) {
+                System.out.println("[INFO ] " + msg);
+            } else if (severity == EventSeverity.WARN) {
+                System.out.println("[WARN ] " + msg);
+            } else if (severity == EventSeverity.ERROR) {
+                System.err.println("[ERROR] " + msg);
+            } else if (severity == EventSeverity.FATAL) {
+                System.err.println("[FATAL] " + msg);
+            } else {
+                assert false;
+            }
+        }
+    }
+
+You can see that for every event the method `processEvent` of the `EventListener` will be called. Inside this method you can do whatever processing you would like including throwing a `RuntimeException`, if you want to abort the current processing run.
+
+The code above also shows how you can turn an event into a human-readable, localized message that can be presented to a user. The `EventFormatter` class does this for you. It provides additional methods if you'd like to explicitly specify the locale.
+
+It is possible to gather all events for a whole processing run so they can be evaluated afterwards. However, care should be taken about memory consumption since the events provide references to objects inside FOP which may themselves have references to other objects. So holding on to these objects may mean that whole object trees cannot be released!
+
+### Adding an EventListener { #add-listener}
+
+To register the event listener with FOP, get the `EventBroadcaster` which is associated with the user agent (`FOUserAgent`) and add it there:
+
+    :::java
+    FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
+    foUserAgent.getEventBroadcaster().addEventListener(new SysOutEventListener());
+
+Please note that this is done separately for each processing run, i.e. for each new user agent.
+
+### An additional listener example { #listener-example1}
+
+Here's an additional example of an event listener:
+
+By default, FOP continues processing even if an image wasn't found. If you have more strict requirements and want FOP to stop if an image is not available, you can do something like the following in the simplest case:
+
+    :::java
+    public class MyEventListener implements EventListener {
+
+        public void processEvent(Event event) {
+            if ("org.apache.fop.ResourceEventProducer".equals(
+                    event.getEventGroupID())) {
+                event.setSeverity(EventSeverity.FATAL);
+            } else {
+                //ignore all other events (or do something of your choice)
+            }
+        }
+
+    }
+
+Increasing the event severity to FATAL will signal the event broadcaster to throw an exception and stop further processing. In the above case, all resource-related events will cause FOP to stop processing.
+
+You can also customize the exception to throw (you can may throw a RuntimeException or subclass yourself) and/or which event to respond to:
+
+    :::java
+    public class MyEventListener implements EventListener {
+
+        public void processEvent(Event event) {
+            if ("org.apache.fop.ResourceEventProducer.imageNotFound"
+                    .equals(event.getEventID())) {
+
+                //Get the FileNotFoundException that's part of the event's parameters
+                FileNotFoundException fnfe = (FileNotFoundException)event.getParam("fnfe");
+
+                throw new RuntimeException(EventFormatter.format(event), fnfe);
+            } else {
+                //ignore all other events (or do something of your choice)
+            }
+        }
+
+    }
+
+This throws a `RuntimeException` with the `FileNotFoundException` as the cause. Further processing effectively stops in FOP. You can catch the exception in your code and react as you see necessary.
+
+## The producer side (for FOP developers) { #producer}
+
+This section is primarily for FOP and FOP plug-in developers. It describes how to use the event subsystem for producing events.
+
+<note>The event package has been designed in order to be theoretically useful for use cases outside FOP. If you think this is interesting independently from FOP, please talk to [us](mailto:fop-dev@xmlgraphics.apache.org).</note>
+
+### Producing and sending an event { #basic-event-production}
+
+The basics are very simple. Just instantiate an `Event` object and fill it with the necessary parameters. Then pass it to the `EventBroadcaster` which distributes the events to the interested listeneners. Here's a code example:
+
+    :::java
+    Event ev = new Event(this, "complain", EventSeverity.WARN,
+            Event.paramsBuilder()
+                .param("reason", "I'm tired")
+                .param("blah", new Integer(23))
+                .build());
+    EventBroadcaster broadcaster = [get it from somewhere];
+    broadcaster.broadcastEvent(ev);
+
+The `Event.paramsBuilder()` is a [fluent interface](http://en.wikipedia.org/wiki/Fluent_interface) to help with the build-up of the parameters. You could just as well instantiate a `Map` (`Map<String, Object>`) and fill it with values.
+
+### The EventProducer interface { #event-producer}
+
+To simplify event production, the event subsystem provides the `EventProducer` interface. You can create interfaces which extend `EventProducer`. These interfaces will contain one method per event to be generated. By contract, each event method must have as its first parameter a parameter named "source" (Type Object) which indicates the object that generated the event. After that come an arbitrary number of parameters of any type as needed by the event.
+
+The event producer interface does not need to have any implementation. The implementation is produced at runtime by a dynamic proxy created by `DefaultEventBroadcaster`. The dynamic proxy creates `Event` instances for each method call against the event producer interface. Each parameter (except "source") is added to the event's parameter map.
+
+To simplify the code needed to get an instance of the event producer interface it is suggested to create a public inner provider class inside the interface.
+
+Here's an example of such an event producer interface:
+
+    :::java
+    public interface MyEventProducer extends EventProducer {
+
+        public class Provider {
+
+            public static MyEventProducer get(EventBroadcaster broadcaster) {
+                return (MyEventProducer)broadcaster.getEventProducerFor(MyEventProducer.class);
+            }
+        }
+
+        /**
+         * Complain about something.
+         * @param source the event source
+         * @param reason the reason for the complaint
+         * @param blah the complaint
+         * @event.severity WARN
+         */
+        void complain(Object source, String reason, int blah);
+
+    }
+
+To produce the same event as in the first example above, you'd use the following code:
+
+    :::java
+    EventBroadcaster broadcaster = [get it from somewhere];
+    TestEventProducer producer = TestEventProducer.Provider.get(broadcaster);
+    producer.complain(this, "I'm tired", 23);
+
+### The event model { #event-model}
+
+Inside an invocation handler for a dynamic proxy, there's no information about the names of each parameter. The JVM doesn't provide it. The only thing you know is the interface and method name. In order to properly fill the `Event` 's parameter map we need to know the parameter names. These are retrieved from an event object model. This is found in the `org.apache.fop.events.model` package. The data for the object model is retrieved from an XML representation of the event model that is loaded as a resource. The XML representation is generated using an Ant task at build time (`ant resourcegen`). The Ant task (found in `src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java`) scans FOP's sources for descendants of the `EventProducer` interface and uses [QDox](https://github.com/codehaus/qdox) to parse these interfaces.
+
+The event model XML files are generated during build by the Ant task mentioned above when running the "resourcegen" task. So just run `"ant resourcegen"` if you receive a `MissingResourceException` at runtime indicating that `"event-model.xml"` is missing.
+
+Primarily, the QDox-based collector task records the parameters' names and types. Furthermore, it extracts additional attributes embedded as Javadoc comments from the methods. At the moment, the only such attribute is "@event.severity" which indicates the default event severity (which can be changed by event listeners). The example event producer above shows the Javadocs for an event method.
+
+There's one more information that is extracted from the event producer information for the event model: an optional primary exception. The first exception in the "throws" declaration of an event method is noted. It is used to throw an exception from the invocation handler if the event has an event severity of "FATAL" when all listeners have been called (listeners can update the event severity). Please note that an implementation of `org.apache.fop.events.EventExceptionManager$ExceptionFactory` has to be registered for the `EventExceptionManager` to be able to construct the exception from an event.
+
+For a given application, there can be multiple event models active at the same time. In FOP, each renderer is considered to be a plug-in and provides its own specific event model. The individual event models are provided through an `EventModelFactory`. This interface is implemented for each event model and registered through the service provider mechanism (see the [plug-ins section](#plug-ins) for details).
+
+### Event severity { #event-severity}
+
+Four different levels of severity for events has been defined:
+
+
+1. INFO: informational only
+
+1. WARN: a Warning
+
+1. ERROR: an error condition from which FOP can recover. FOP will continue processing.
+
+1. FATAL: a fatal error which causes an exception in the end and FOP will stop processing.
+
+Event listeners can choose to ignore certain events based on their event severity. Please note that you may recieve an event "twice" in a specific case: if there is a fatal error an event is generated and sent to the listeners. After that an exception is thrown with the same information and processing stops. If the fatal event is shown to the user and the following exception is equally presented to the user it may appear that the event is duplicated. Of course, the same information is just published through two different channels.
+
+### Plug-ins to the event subsystem { #plug-ins}
+
+The event subsystem is extensible. There are a number of extension points:
+
+
+-  **`org.apache.fop.events.model.EventModelFactory`:** Provides an event model to the event subsystem.
+
+-  **`org.apache.fop.events.EventExceptionManager$ExceptionFactory`:** Creates exceptions for events, i.e. turns an event into a specific exception.
+
+The names in bold above are used as filenames for the service provider files that are placed in the `META-INF/services` directory. That way, they are automatically detected. This is a mechanism defined by the [JAR file specification](http://docs.oracle.com/javase/1.5.0/docs/guide/jar/jar.html#Service%20Provider).
+
+### Localization (L10n) { #l10n}
+
+One goal of the event subsystem was to have localized (translated) event messages. The `EventFormatter` class can be used to convert an event to a human-readable message. Each `EventProducer` can provide its own XML-based translation file. If there is none, a central translation file is used, called "EventFormatter.xml" (found in the same directory as the `EventFormatter` class).
+
+The XML format used by the `EventFormatter` is the same as [Apache Cocoon's](http://cocoon.apache.org/) catalog format. Here's an example:
+
+    :::xml
+    <?xml version="1.0" encoding="UTF-8"?>
+    <catalogue xml:lang="en">
+      <message key="locator">
+        [ (See position {loc})| (See { #gatherContextInfo})| (No context info available)]
+      </message>
+      <message key="org.apache.fop.render.rtf.RTFEventProducer.explicitTableColumnsRequired">
+        RTF output requires that all table-columns for a table are defined. Output will be incorrect.{{locator}}
+      </message>
+      <message key="org.apache.fop.render.rtf.RTFEventProducer.ignoredDeferredEvent">
+        Ignored deferred event for {node} ({start,if,start,end}).{{locator}}
+      </message>
+    </catalogue>
+
+The example (extracted from the RTF handler's event producer) has message templates for two event methods. The class used to do variable replacement in the templates is `org.apache.fop.util.text.AdvancedMessageFormat` which is more powerful than the `MessageFormat` classes provided by the Java class library (`java.util.text` package).
+
+"locator" is a template that is reused by the other message templates by referencing it through "{{locator}}". This is some kind of include command.
+
+Normal event parameters are accessed by name inside single curly braces, for example: "{node}". For objects, this format just uses the `toString()` method to turn the object into a string, unless there is an `ObjectFormatter` registered for that type (there's an example for `org.xml.sax.Locator`).
+
+The single curly braces pattern supports additional features. For example, it is possible to do this: "{start,if,start,end}". "if" here is a special field modifier that evaluates "start" as a boolean and if that is true returns the text right after the second comma ("start"). Otherwise it returns the text after the third comma ("end"). The "equals" modifier is similar to "if" but it takes as an additional (comma-separated) parameter right after the "equals" modifier, a string that is compared to the value of the variable. An example: {severity,equals,EventSeverity:FATAL,,some text} (this adds "some text" if the severity is not FATAL).
+
+Additional such modifiers can be added by implementing the `AdvancedMessageFormat$Part` and `AdvancedMessageFormat$PartFactory` interfaces.
+
+Square braces can be used to specify optional template sections. The whole section will be omitted if any of the variables used within are unavailable. Pipe (|) characters can be used to specify alternative sub-templates (see "locator" above for an example).
+
+Developers can also register a function (in the above example: `{ #gatherContextInfo})` to do more complex information rendering. These functions are implementations of the `AdvancedMessageFormat$Function` interface. Please take care that this is done in a locale-independent way as there is no locale information available, yet.

Propchange: xmlgraphics/site/trunk/content/fop/2.5/events.mdtext
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/site/trunk/content/fop/2.5/events.mdtext
------------------------------------------------------------------------------
    svn:executable = *

Added: xmlgraphics/site/trunk/content/fop/2.5/extensions.mdtext
URL: http://svn.apache.org/viewvc/xmlgraphics/site/trunk/content/fop/2.5/extensions.mdtext?rev=1877686&view=auto
==============================================================================
--- xmlgraphics/site/trunk/content/fop/2.5/extensions.mdtext (added)
+++ xmlgraphics/site/trunk/content/fop/2.5/extensions.mdtext Wed May 13 09:41:31 2020
@@ -0,0 +1,227 @@
+Title: Standard Apache(tm) FOP Extensions
+
+#Standard Apache(tm) FOP Extensions
+
+
+By "extension", we mean any data that can be placed in the input XML document that is not addressed by the XSL-FO standard. By having a mechanism for supporting extensions, Apache&trade; FOP is able to add features that are not covered in the specification.
+
+The extensions documented here are included with FOP, and are automatically available to you. If you wish to add an extension of your own to FOP, please see the [Developers' Extension Page](../dev/extensions.html).
+
+<note>All extensions require the correct use of an appropriate namespace in your input document.</note>
+
+## SVG { #svg}
+
+Please see the [SVG documentation](graphics.html#svg) for more details.
+
+## FO Extensions { #fo-extensions}
+
+### Namespace { #fox-namespace}
+
+By convention, FO extensions in FOP use the "fox" namespace prefix. To use any of the FO extensions, add a namespace entry for `http://xmlgraphics.apache.org/fop/extensions` to the root element:
+
+    :::xml
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
+             xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">
+
+### PDF Bookmarks { #bookmarks}
+
+In old versions of Apache FOP there was a `fox:outline` element which was used to create outlines in PDF files. The redesigned code makes use of the [bookmark feature defined in the W3C XSL 1.1 standard](http://www.w3.org/TR/xsl11/#fo_bookmark-tree).
+
+### Anchors or Named Destinations { #named-destinations}
+
+Use the fox:destination element to define "named destinations" inside a PDF document. These are useful as fragment identifiers, e.g. "http://server/document.pdf#anchor-name". fox:destination elements can be placed almost anywhere in the fo document, including a child of root, a block-level element, or an inline-level element. For the destination to actually work, it must correspond to an "id" attribute on some fo element within the document. In other words, the "id" attribute actually creates the "view" within the PDF document. The fox:destination simply gives that view an independent name.
+
+    :::xml
+    <fox:destination internal-destination="table-of-contents"/>
+    ...
+    <fo:block id="table-of-contents">Table of Contents</fo:block>
+
+<warning>It is possible that in some future release of FOP, *all* elements with "id" attributes will generate named-destinations, which will eliminate the need for fox:destination.</warning>
+
+### Table Continuation Label { #table-continue-label}
+
+In old versions of Apache FOP, there was a `fox:continued-label` element which was used to insert a message when a table went over several pages.
+This extension element will not be reimplemented for the redesigned code.
+The redesigned code makes use of the [`fo:retrieve-table-marker`](http://www.w3.org/TR/xsl11/#fo_retrieve-table-marker) element defined in the [W3C XSL 1.1](http://www.w3.org/TR/xsl11/) standard.
+
+### Row Scope for Header Table Cells
+
+This feature is described in the [Accessibility](accessibility.html#fox:header) section.
+
+### fox:orphan-content-limit and fox:widow-content-limit { #widow-orphan-content-limit}
+
+The two proprietary extension properties, `fox:orphan-content-limit` and `fox:widow-content-limit`, are used to improve the layout of list-blocks and tables. If you have a table with many entries, you don't want a single row to be left over on a page. You will want to make sure that at least two or three lines are kept together. The properties take an absolute length which specifies the area at the beginning (`fox:widow-content-limit`) or at the end (`fox:orphan-content-limit`) of a table or list-block. The properties are inherited and only have an effect on `fo:table` and `fo:list-block`. An example: `fox:widow-content-limit="3 * 1.2em"` would make sure the you'll have at least three lines (assuming `line-height="1.2"`) together on a table or list-block.
+
+### fox:external-document { #external-document}
+
+<note>This feature is incomplete. Support for multi-page documents will be added shortly. At the moment, only single-page images will work. And this will not work with RTF output.</note>
+
+This is a proprietary extension element which allows to add whole images as pages to an FO document. For example, if you have a scanned document or a fax as multi-page TIFF file, you can append or insert this document using the `fox:external-document` element. Each page of the external document will create one full page in the target format.
+
+The `fox:external-document` element is structurally a peer to `fo:page-sequence`, so wherever you can put an `fo:page-sequence` you could also place a `fox:external-document`. Therefore, the specified contents for `fo:root` change to:
+
+    (layout-master-set, declarations?, bookmark-tree?, (page-sequence|page-sequence-wrapper|fox:external-document|fox:destination)+)
+
+#### Specification { #Specification}
+
+The `fox:external-document` extension formatting object is used to specify how to create a (sub-)sequence of pages within a document. The content of these pages comes from the individual subimages/pages of an image or paged document (for example: multi-page TIFF in the form of faxes or scanned documents, or PDF files). The formatting object creates the necessary areas to display one image per page.
+
+In terms of page numbers, the behaviour is the same as for `fo:page-sequence`. The placement of the image inside the page is similar to that of `fo:external-graphic` or `fo:instream-foreign-object`, i.e. the viewport (and therefore the page size) is defined by either the intrinsic size of the image or by the size properties that apply to this formatting object.
+
+Content: EMPTY
+
+The following properties apply to this formatting object:
+
+
+- (Common Accessibility Properties) (not implemented, yet)
+
+- (Common Aural Properties) (not implemented, yet)
+
+- block-progression-dimension
+
+- content-height
+
+- content-type
+
+- content-width
+
+- display-align
+
+- height
+
+- id
+
+- inline-progression-dimension
+
+- overflow
+
+- pages: <page-set> (see below) (not implemented, yet)
+
+- reference-orientation
+
+- scaling
+
+- scaling-method
+
+- src
+
+- text-align
+
+- width
+
+Datatype "page-set": Value: auto | <integer-range>, Default: "auto" which means all pages/subimages of the document. <integer-range> allows values such as "7" or "1-3"
+
+<note>`fox:external-document` is not suitable for concatenating FO documents.</note>
+
+For this, XInclude is recommended.
+
+### Free-form Transformation for fo:block-container { #transform}
+
+For `fo:block-container` elements whose `absolute-position` set to "absolute" or "fixed" you can use the extension attribute `fox:transform` to apply a free-form transformation to the whole block-container. The content of the `fox:transform` attribute is the same as for [SVG's transform attribute](http://www.w3.org/TR/SVG/coords.html#TransformAttribute). The transformation specified here is performed in addition to other implicit transformations of the block-container (resulting from top, left and other properties) and after them.
+
+Examples: `fox:transform="rotate(45)"` would rotate the block-container by 45 degrees clock-wise around its upper-left corner. `fox:transform="translate(10000,0)"` would move the block-container to the right by 10 points (=10000 millipoints, FOP uses millipoints internally!).
+
+<note>This extension attribute doesn't work for all output formats! It's currently only supported for PDF, PS and Java2D-based renderers.</note>
+
+### Color functions { #color-functions}
+
+XSL-FO supports specifying color using the rgb(), rgb-icc() and system-color() functions. Apache FOP provides additional color functions for special use cases. Please note that using these functions compromises the interoperability of an FO document.
+
+#### cmyk() { #color-function-cmyk}
+
+ `color cmyk(numeric, numeric, numeric, numeric)`
+
+This function will construct a color in device-specific CMYK color space. The numbers must be between 0.0 and 1.0. For output formats that don't support device-specific color space the CMYK value is converted to an sRGB value.
+
+#### #CMYK pseudo-profile { #pseudo-color-profiles}
+
+ `color rgb-icc(numeric, numeric, numeric, #CMYK, numeric, numeric, numeric, numeric)`
+
+The `rgb-icc` function will respond to a pseudo-profile called "#CMYK" which indicates a device-specific CMYK color space. The "#CMYK" profile is implicitely available and doesn't have to be (and cannot be) defined through an `fo:color-profile` element. It is provided for compatibility with certain commercial XSL-FO implementations. Please note that this is not part of the official specification but rather a convention. The following two color specifications are equivalent:
+
+
+-  `cmyk(0%,0%,20%,40%)`
+
+-  `rgb-icc(153, 153, 102, #CMYK, 0, 0, 0.2, 0.4)`
+
+### Rounded Corners { #rounded-corners}
+
+Rounded corners on block areas can be specified with the `fox:border-*-*-radius` properties. Each corner can be specified with two radii that define a quarter ellipse that defines the shape of the corner of the outer border edge (in accordance with the [W3 CSS3 Recommendation](http://www.w3.org/TR/css3-background/#the-border-radius)).
+The property `fox:border-BP-IP-radius` specifies the radius of the corner connecting border segment *BP* is one of '*before|after*' and *IP* is one of 'start|end*', and takes one or two values.  A single value will generate circular corners.  Two values define elliptic corners where the first value defines the radius in the *Inline Progression Direction*, and the second the radius in the *Block Progression Direction*.
+
+The shorthand property `fox:border-radius` can be used to specify uniform corners and takes 1 or 2 values, as above.
+
+The example fo `examples/fo/advanced/rounded-corners.fo` demonstrates some finer points of this extension.
+
+####Current Limitations###
+-  CSS3-style absolute properties, e.g `border-top-left-radius`, are not supported
+
+-  Rounded corners on tables are not directly supported.  To set rounded corners at the table level the table must have the property `border-collapse` property set to `separate`
+
+
+### Prepress Support { #prepress}
+
+This section defines a number of extensions related to [prepress](http://en.wikipedia.org/wiki/Prepress) support. `fox:scale` defines a general scale factor for the generated pages. `fox:bleed` defines the [bleed area](http://en.wikipedia.org/wiki/Bleed_%28printing%29) for a page. `fox:crop-offset` defines the outer edges of the area in which crop marks, registration marks, color bars and page information are placed. For details, please read on below.
+
+<note>Those extensions have been implemented in the PDF and Java2D renderers only.</note>
+
+#### fox:scale { #scale}
+
+Value: <number>{1,2}
+
+Initial: 1
+
+Applies to: fo:simple-page-master
+
+This property specifies a scale factor along resp. the x and y axes. If only one number is provided it is used for both the x and y scales. A scale factor smaller than 1 shrinks the page. A scale factor greater than 1 enlarges the page.
+
+#### fox:bleed { #bleed}
+
+Value: <length>{1,4}
+
+Initial: 0pt
+
+Applies to: fo:simple-page-master
+
+If there is only one value, it applies to all sides. If there are two values, the top and bottom bleed widths are set to the first value and the right and left bleed widths are set to the second. If there are three values, the top is set to the first value, the left and right are set to the second, and the bottom is set to the third. If there are four values, they apply to the top, right, bottom, and left, respectively. (Corresponds to [the definition of padding](http://www.w3.org/TR/xsl11/#padding)).
+
+This extension indirectly defines the BleedBox and is calculated by expanding the TrimBox by the bleed widths. The lengths must be non-negative.
+
+#### fox:crop-offset { #cropOffset}
+
+Value: <length>{1,4}
+
+Initial: bleed (see below)
+
+Applies to: fo:simple-page-master
+
+Same behaviour as with fox:bleed. The initial value is set to the same values as the fox:bleed property.
+
+This extension indirectly defines the MediaBox and is calculated by expanding the TrimBox by the crop offsets. The lengths must be non-negative.
+
+#### fox:crop-box { #cropBox}
+
+Value: [trim-box | bleed-box | media-box]
+
+Initial: media-box
+
+Applies to: fo:simple-page-master
+
+The crop box controls how Acrobat displays the page (CropBox in PDF) or how the Java2DRenderer sizes the output media. The PDF specification defines that the CropBox defaults to the MediaBox. This extension follows that definition. To simplify usage and cover most use cases, the three supported enumeration values "trim-box", "bleed-box" and "media-box" set the CropBox to one of those three other boxes.
+
+If requested in the future, we could offer to specify the CropBox in absolute coordinates rather than just by referencing another box.
+
+### Background Images { #backgroundimages}
+
+Background images can be resized on the fly using these two extensions:
+
+#### fox:background-image-width { #backgroundImageWidth}
+
+Value: length
+
+#### fox:background-image-height { #backgroundImageHeight}
+
+Value: length
+
+These extensions apply to the elements where background-image applies.
+

Propchange: xmlgraphics/site/trunk/content/fop/2.5/extensions.mdtext
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/site/trunk/content/fop/2.5/extensions.mdtext
------------------------------------------------------------------------------
    svn:executable = *

Added: xmlgraphics/site/trunk/content/fop/2.5/fonts.mdtext
URL: http://svn.apache.org/viewvc/xmlgraphics/site/trunk/content/fop/2.5/fonts.mdtext?rev=1877686&view=auto
==============================================================================
--- xmlgraphics/site/trunk/content/fop/2.5/fonts.mdtext (added)
+++ xmlgraphics/site/trunk/content/fop/2.5/fonts.mdtext Wed May 13 09:41:31 2020
@@ -0,0 +1,254 @@
+Title: Apache(tm) FOP: Fonts
+
+#Apache&trade; FOP: Fonts
+<authors><person email="" name="Jeremias Märki"></person><person email="" name="Tore Engvig"></person><person email="" name="Adrian Cumiskey"></person><person email="" name="Max Berger"></person></authors>
+
+## Summary { #intro}
+
+The following table summarizes the font capabilities of the various Apache&trade; FOP renderers:
+
+| Renderer | Base-14 | AWT/OS | Custom | Custom Embedding |
+|----------|---------|--------|--------|------------------|
+| PDF | yes | no | yes | yes |
+| PostScript | yes | no | yes | yes |
+| PCL | yes (modified) | yes (painted as bitmaps) | yes (painted as bitmaps) | no |
+| AFP | no | no | yes | yes |
+| Java2D/AWT/Bitmap | if available from OS | yes | yes | n/a (display only) |
+| Print | if available from OS | yes | yes | controlled by OS printer driver |
+| RTF | n/a (font metrics not needed) | n/a | n/a | n/a |
+| TXT | yes (used for layout but not for output) | no | yes (used for layout but not for output) | no |
+| XML | yes | no | yes | n/a |
+
+Note that Java2D based renderers (Java2D, AWT, Print, TIFF, PNG) support both system (AWT/OS) and custom fonts.
+
+## Base-14 Fonts { #Base-14-Fonts}
+
+The Adobe PostScript and PDF Specification specify a set of 14 fonts that must be available to every PostScript interpreter and PDF reader: Helvetica (normal, bold, italic, bold italic), Times (normal, bold, italic, bold italic), Courier (normal, bold, italic, bold italic), Symbol and ZapfDingbats.
+
+The following font family names are hard-coded into FOP for the Base-14 font set:
+
+| Base-14 font | font families |
+|--------------|---------------|
+| Helvetica | Helvetica, sans-serif, SansSerif |
+| Times | Times, Times Roman, Times-Roman, serif, any |
+| Courier | Courier, monospace, Monospaced |
+| Symbol | Symbol |
+| ZapfDingbats | ZapfDingbats |
+
+Please note that recent versions of Adobe Acrobat Reader replace "Helvetica" with "Arial" and "Times" with "Times New Roman" internally. GhostScript replaces "Helvetica" with "Nimbus Sans L" and "Times" with "Nimbus Roman No9 L". Other document viewers may do similar font substitutions. If you need to make sure that there are no such substitutions, you need to specify an explicit font and embed it in the target document.
+
+## Missing Fonts { #missing-fonts}
+
+When FOP does not have a specific font at its disposal (because it's not installed in the operating system or set up in FOP's configuration), the font is replaced with "any". "any" is internally mapped to the Base-14 font "Times" (see above).
+
+## Missing Glyphs { #missing-glyphs}
+
+Every font contains a particular set of [glyphs](http://en.wikipedia.org/wiki/Glyph). If no glyph can be found for a given character, FOP will issue a warning and use the glpyh for "#" (if available) instead. Before it does that, it consults a (currently hard-coded) registry of glyph substitution groups (see Glyphs.java in Apache XML Graphics Commons). This registry can supply alternative glyphs in some cases (like using space when a no-break space is requested). But there's no guarantee that the result will be as expected (for example, in the case of hyphens and similar glyphs). A better way is to use a font that has all the necessary glyphs. This glyph substitution is only a last resort.
+
+## System Fonts { #awt}
+
+Support for system fonts relies on the Java AWT subsystem for font metric information. Through operating system registration, the AWT subsystem knows what fonts are available on the system, and the font metrics for each one.
+
+When working with renderers that supports system fonts (see above table) and you're missing a font, you can just install it in your operating system and it should be available for these renderers. Please note that this is not true for output formats, such as PDF or PostScript, that only support custom fonts.
+
+## Custom Fonts { #custom}
+
+| Renderer   | TTF | TTC | Type1 | OTF | AFP Fonts |
+|------------|-----|-----|-------|-----|-----------|
+| PDF        | yes | yes | yes | yes | no |
+| Postscript | yes | yes | yes | yes | no |
+| AFP | yes | no | no | no | yes |
+| PCL | yes | yes | bitmap | bitmap | no |
+| TIFF | bitmap | bitmap | bitmap | bitmap | no |
+
+Support for custom fonts is highly output format dependent (see above table). This section shows how to add Type 1, TrueType (TTF) and OpenType (OTF) fonts to the PDF, PostScript and Java2D-based renderers. Other renderers (like AFP) support other font formats. Details in this case can be found on the page about [output formats](output.html).
+
+In earlier FOP versions, it was always necessary to create an XML font metrics file if you wanted to add a custom font. This inconvenient step has been removed and in addition to that, FOP supports auto-registration of fonts, i.e. FOP can find fonts installed in your operating system or can scan user-specified directories for fonts. Font registration via XML font metrics has been deprecated and is not recommended although it is still supported by the current code.
+
+More information about fonts can be found at [Adobe Font Technical Notes](http://www.adobe.com/devnet/font.html).
+
+### OpenType Advanced Font Features
+
+OpenType fonts support advanced layout features such as ligatures, small caps, swashes, alternates, old style figures and more. Please see [Advanced Typographic Extensions - OpenType Layout](http://www.microsoft.com/typography/otspec/TTOCHAP1.htm). These features are currently missing within FOP due to the implementation opting to favor a greater number of formats. 
+
+While FOP may support embedding OpenType with advanced features in the future, the current method extracts the Compact Font Format (CFF) data containing among other things the character definitions, optionally subsets and embeds the result as a Type1C font. This allows the font to be used by both Postscript and older PDF versions while losing the features mentioned above. This is because embedding Open-Type in it's original state is only supported by PDF 1.6 and above.
+
+## Bulk Font Configuration { #bulk}
+
+If you want FOP to use custom fonts, you need to tell it where to find them. This is done in the configuration file and once per renderer (because each output format is a little different). For convenience, FOP allows bulk registering of fonts; you can either tell FOP to find your operating system fonts or you can specify directories that it will search for support fonts. These fonts will then automatically be registered.
+
+    :::xml
+    <renderers>
+      <renderer mime="application/pdf">
+         <fonts>
+            <!-- register all the fonts found in a directory -->
+            <directory>C:\MyFonts1</directory>
+
+            <!-- register all the fonts found in a directory and all of its sub directories (use with care) -->
+            <directory recursive="true">C:\MyFonts2</directory>
+
+            <!-- automatically detect operating system installed fonts -->
+            <auto-detect/>
+         </fonts>
+      </renderer>
+    </renderers>
+
+<note>Review the documentation for [FOP Configuration](configuration.html) for instructions on making the FOP configuration available to FOP when it runs. Otherwise, FOP has no way of finding your custom font information. It is currently not possible to easily configure fonts from Java code.</note>
+
+### Register Fonts with FOP { #register}
+
+You must tell FOP how to find and use the font files by registering them in the [FOP Configuration](configuration.html). Add entries for your custom fonts, regardless of font type, to the configuration file in a manner similar to the following:
+
+    :::xml
+    <renderers>
+       <renderer mime="application/pdf">
+           <fonts>
+               <font kerning="yes" embed-url="/System/Library/Fonts/Arial.ttf" embedding-mode="subset">
+                   <font-triplet name="Arial" style="normal" weight="normal"/>
+               </font>
+               <font kerning="yes" embed-url="/System/Library/Fonts/AEHO____.PFB">
+                   <font-triplet name="Avenir-HeavyOblique" style="normal" weight="bold"/>
+               </font>
+           </fonts>
+       </renderer>
+    </renderers>
+
+- The "embed-url" attribute is used to specify the font file. Relative URLs are resolved relative to the font-base property (or base) if available. See [FOP: Configuration](configuration.html) for more information. 
+
+- The "embedding-mode" attribute is optional and can take two values: subset (the default) and full. If not specified the font is subset embedded for TTF and OTF or full embedded for Type 1, unless it is explicitly referenced (see below).
+
+- The font "kerning" attribute is optional. Default is "true".
+
+- The "embed-as-type1" attribute is optional, setting to "true" converts OTF fonts to Type 1 for postscript output.
+
+- The "simulate-style" attribute is optional, setting to "true" generates bold and oblique looking glyphs for PDF output.
+
+- When setting the "embed-url" attribute for Type 1 fonts, be sure to specify the PFB (actual font data), not the PFM (font metrics) file. If the PFM (or AFM) file is in a different location (i.e., not in the same directory) then you need to specify an "embed-url-pfm" (or "embed-url-afm") attribute next to the "embed-url" one.
+
+- The attribute "encoding-mode" is optional an may have the following values:
+
+    - auto: default font encoding mode ("cid" for Truetype, "single-byte" for Type 1)
+
+    - single-byte: use single-byte encodings in the target format (if applicable)
+
+    - cid: encode as CID-keyed font (currently only supported for PDF output with TrueType fonts)
+
+- The fonts "directory" tag can be used to register fonts contained within a single or list of directory paths. The "recursive" attribute can be specified to recursively add fonts from all sub directories.
+
+- The fonts "auto-detect" tag can be used to automatically register fonts that are found to be installed on the native operating system.
+
+- Fonts registered with "font" tag configurations override fonts found by means of "directory" tag definitions.
+
+- Fonts found as a result of a "directory" tag configuration override fonts found as a result of the "auto-detect" tag being specified.
+
+- If relative URLs are specified, they are evaluated relative to the value of the "font-base" setting. If there is no "font-base" setting, the fonts are evaluated relative to the base directory.
+
+- If a fop.xconf is not used, or the "embed-url" attribute is missing, the fonts are referenced (and the default Base-14 is used in this case).
+
+### TrueType Collections { #truetype-collections-metrics}
+
+TrueType collections (.ttc files) contain more than one font. The individual sub-fonts of a TrueType Collection can be selected using the "sub-font" attribute on the "font" element. Example:
+
+    :::xml
+    <font embed-url="gulim.ttc" sub-font="GulimChe">
+      <font-triplet name="GulimChe" style="normal" weight="normal"/>
+    </font>
+
+### Auto-Detect and auto-embed feature { #autodetect}
+
+When the "auto-detect" flag is set in the configuration, FOP will automatically search for fonts in the default paths for your operating system.
+
+FOP will also auto-detect fonts which are available in the classpath, if they are described as "application/x-font" in the MANIFEST.MF file. For example, if your .jar file contains font/myfont.ttf:
+
+    Manifest-Version: 1.0
+
+        Name: font/myfont.ttf
+        Content-Type: application/x-font
+
+This feature allows you to create JAR files containing fonts. The JAR files can be added to fop by providem them in the classpath, e.g. copying them into the lib/ directory.
+
+#### The font cache { #font-cache}
+
+Apache FOP maintains a cache file that is used to speed up auto-detection. This file is usually found in the ".fop" directory under the user's home directory. It's called "fop-fonts.cache". When the user's home directory is not writable, the font cache file is put in the directory for temporary files.
+
+If there was a problem loading a particular font, it is flagged in the cache file so it is not loaded anymore. So, if a font is actually around but is still not found by Apache FOP, it's worth a try to delete the font cache file which forces Apache FOP to reparse all fonts.
+
+### Referencing Fonts { #referencing_fonts}
+
+By default, all fonts are embedded if an output format supports font embedding. In some cases, however, it is preferred that some fonts are only referenced. When working with referenced fonts it is important to be in control of the target environment where the produced document is consumed, i.e. the necessary fonts have to be installed there.
+
+There are two different ways how you can specify that a font should be referenced:
+
+1. When explicitly configuring a font, font referencing is controlled by the embed-url attribute. If you don't specify the embed-url attribute the font will not be embedded, but will only be referenced.
+
+1. For automatically configured fonts there's a different mechanism to specify which fonts should be referenced rather than embedded. This is done in the "referenced-fonts" element in the configuration. Here's an example:
+
+        :::xml
+        <fop version="1.0">
+          <fonts>
+            <referenced-fonts>
+              <match font-family="Helvetica"/>
+              <match font-family="DejaVu.*"/>
+            </referenced-fonts>
+          </fonts>
+        </fop>
+
+At the moment, you can only match fonts against their font-family. It is possible to use regular expressions as is shown in the second example above ("DejaVu.*"). The syntax for the regular expressions used here are the one used by the [package](https://docs.oracle.com/javase/7/docs/api/java/util/regex/package-summary.html). So, in the above snippet "Helvetica" and all variants of the "DejaVu" font family are referenced. If you want to reference all fonts, just specify `font-family=".*"`.
+
+The `referenced-fonts` element can be placed either inside the general `fonts` element (right under the root) or in the `fonts` element under the renderer configuration. In the first case, matches apply to all renderers. In the second case, matches only apply to the renderer where the element was specified. Both cases can be used at the same time.
+
+### Embedding Fonts { #embedding_fonts}
+
+Some notes related to embedded fonts:
+
+- When FOP embeds a font in PDF, it adds a prefix to the fontname to ensure that the name will not match the fontname of an installed font. This is helpful with older versions of Acrobat Reader that preferred installed fonts over embedded fonts.
+
+- When embedding PostScript fonts, the entire font is always embedded.
+
+- When embedding TrueType (ttf) or TrueType Collections (ttc), a subset of the original font, containing only the glyphs used, is embedded in the output document. That's the default, but if you specify encoding-mode="single-byte" (see above), the complete font is embedded.
+
+### Font Substitution { #font_substitution}
+
+When a `<substitutions/>` section is defined in the configuration, FOP will re-map any font-family references found in your FO input to a given substitution font.
+
+- If a `<substitution/>` is declared, it is mandatory that both a <from/> and <to/> child element is declared with a font-family attribute.
+
+- Both font-weight and font-style are optional attributes, if they are provided then a value of 'normal' is assumed.
+
+For example you could make all FO font-family references to 'Arial' with weights between 700 and 900 reference the normal 'Arial Black' font.
+
+    :::xml
+    <fop version="1.0">
+      <fonts>
+        <substitutions>
+          <substitution>
+            <from font-family="Arial" font-weight="700..900"/>
+            <to font-family="Arial Black"/>
+          </substitution>
+          <substitution>
+            <from font-family="FrutigerLight"/>
+            <to font-family="Times" font-weight="bold" font-style="italic"/>
+          </substitution>
+        </substitutions>
+      </fonts>
+    </fop>
+
+## Font Selection Strategies { #selection}
+
+There are two font selection strategies: character-by-character or auto. The default is auto.
+
+Auto selected the first font from the list which is able to display the most characters in a given word. This means (assume font A has characters for abclmn, font B for lnmxyz, fontlist is A,B):
+
+- aaa lll xxx would be displayed in fonts A A B
+
+- aaaxx would be displayed in font A
+
+- aaaxxx would be displayed in font A
+
+- aaaxxxx would be displayed in font B
+
+Character-by-Character is NOT yet supported!
+
+## Font List Command-Line Tool { #font-list}
+
+FOP contains a small command-line tool that lets you generate a list of all configured fonts. Its class name is: `org.apache.fop.tools.fontlist.FontListMain`. Run it with the "-?" parameter to get help for the various options.
\ No newline at end of file

Propchange: xmlgraphics/site/trunk/content/fop/2.5/fonts.mdtext
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/site/trunk/content/fop/2.5/fonts.mdtext
------------------------------------------------------------------------------
    svn:executable = *



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org