xmlgraphics-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sstei...@apache.org
Subject svn commit: r1787787 [6/6] - in /xmlgraphics/site/trunk/content/fop/2.2: ./ images/
Date Mon, 20 Mar 2017 14:52:18 GMT
Added: xmlgraphics/site/trunk/content/fop/2.2/running.mdtext
URL: http://svn.apache.org/viewvc/xmlgraphics/site/trunk/content/fop/2.2/running.mdtext?rev=1787787&view=auto
==============================================================================
--- xmlgraphics/site/trunk/content/fop/2.2/running.mdtext (added)
+++ xmlgraphics/site/trunk/content/fop/2.2/running.mdtext Mon Mar 20 14:52:17 2017
@@ -0,0 +1,206 @@
+Title: Running Apache™ FOP
+
+#Running Apache™ FOP
+
+
+## System Requirements { #require}
+
+The following software must be installed:
+
+
+- Java {{ fop_minimal_java_requirement }} or later Runtime Environment.
+
+
+- Apache™ FOP. The [FOP distribution](../download.html) includes all libraries
that you will need to run a basic FOP installation. These can be found in the [fop-root]/lib
directory. These libraries include the following:
+
+    -  [Apache XML Graphics Commons](http://xmlgraphics.apache.org/commons/), an shared library
for Batik and FOP.
+
+    -  [Apache Batik](http://xmlgraphics.apache.org/batik/), an SVG library.
+
+    -  [Apache Commons Logging](http://commons.apache.org/logging/), a logger abstraction
kit.
+
+    -  [Apache Commons IO](http://commons.apache.org/io/), a library with I/O utilities.
+
+    -  [Apache Excalibur/Avalon Framework](http://excalibur.apache.org/framework/), for XML
configuration handling.
+
+
+The following software is optional, depending on your needs:
+
+
+- Graphics libraries. Generally, FOP contains direct support for the most important bitmap
image formats (including PNG, JPEG and GIF). See [FOP: Graphics Formats](graphics.html) for
details.
+
+- PDF encryption. See [FOP: PDF Encryption](pdfencryption.html) for details.
+
+In addition, the following system requirements apply:
+
+
+- If you will be using FOP to process SVG, you must do so in a graphical environment. See
[FOP: Graphics (Batik)](graphics.html#batik) for details.
+
+## Installation { #install}
+
+### Instructions { #install-instruct}
+
+Basic FOP installation consists of first unzipping the `.gz` file that is the distribution
medium, then unarchiving the resulting `.tar` file in a directory/folder that is convenient
on your system. Please consult your operating system documentation or Zip application software
documentation for instructions specific to your site.
+
+### Problems { #install-problems}
+
+Some Mac OSX users have experienced filename truncation problems using Stuffit to unzip and
unarchive their distribution media. This is a legacy of older Mac operating systems, which
had a 31-character pathname limit. Several Mac OSX users have recommended that Mac OSX users
use the shell command `tar -xzf` instead.
+
+## Starting FOP as a Standalone Application { #standalone-start}
+
+### Using the fop script or batch file { #fop-script}
+
+The usual and recommended practice for starting FOP from the command line is to run the batch
file fop.bat (Windows) or the shell script fop (Unix/Linux). These scripts require that the
environment variable JAVA_HOME be set to a path pointing to the appropriate Java installation
on your system. Macintosh OSX includes a Java environment as part of its distribution. We
are told by Mac OSX users that the path to use in this case is `/Library/Java/Home`. **Caveat:**
We suspect that, as Apple releases new Java environments and as FOP upgrades the minimum Java
requirements, the two will inevitably not match on some systems. Please see [Java on Mac OSX
FAQ](https://java.com/en/download/faq/java_mac.xml) for information as it becomes available.
+
+    USAGE
+    Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl|-ps|-txt|-at
[mime]|-print] <outfile>
+     [OPTIONS]
+      -version          print FOP version and exit
+      -d                debug mode
+      -x                dump configuration settings
+      -q                quiet mode
+      -c cfg.xml        use additional configuration file cfg.xml
+      -l lang           the language to use for user information
+      -nocs             disable complex script features
+      -r                relaxed/less strict validation (where available)
+      -dpi xxx          target resolution in dots per inch (dpi) where xxx is a number
+      -s                for area tree XML, down to block areas only
+      -v                run in verbose mode (currently simply print FOP version and continue)
+
+      -o [password]     PDF file will be encrypted with option owner password
+      -u [password]     PDF file will be encrypted with option user password
+      -noprint          PDF file will be encrypted without printing permission
+      -nocopy           PDF file will be encrypted without copy content permission
+      -noedit           PDF file will be encrypted without edit content permission
+      -noannotations    PDF file will be encrypted without edit annotation permission
+      -nofillinforms    PDF file will be encrypted without fill in forms permission
+      -noaccesscontent  PDF file will be encrypted without extract text and graphics permission
+      -noassembledoc    PDF file will be encrypted without assemble the document permission
+      -noprinthq        PDF file will be encrypted without print high quality permission
+      -a                enables accessibility features (Tagged PDF etc., default off)
+      -pdfprofile prof  PDF file will be generated with the specified profile
+                        (Examples for prof: PDF/A-1b or PDF/X-3:2003)
+
+      -conserve         enable memory-conservation policy (trades memory-consumption for
disk I/O)
+                        (Note: currently only influences whether the area tree is serialized.)
+
+      -cache            specifies a file/directory path location
+      -flush            flushes the current font cache file
+
+     [INPUT]
+      infile            xsl:fo input file (the same as the next)
+                        (use '-' for infile to pipe input from stdin)
+      -fo  infile       xsl:fo input file
+      -xml infile       xml input file, must be used together with -xsl
+      -atin infile      area tree input file
+      -ifin infile      intermediate format input file
+      -imagein infile   image input file (piping through stdin not supported)
+      -xsl stylesheet   xslt stylesheet
+
+      -param name value <value> to use for parameter <name> in xslt stylesheet
+                        (repeat '-param name value' for each parameter)
+
+      -catalog          use catalog resolver for input XML and XSLT files
+     [OUTPUT]
+      outfile           input will be rendered as PDF into outfile
+                        (use '-' for outfile to pipe output to stdout)
+      -pdf outfile      input will be rendered as PDF (outfile req'd)
+      -pdfa1b outfile   input will be rendered as PDF/A-1b compliant PDF
+                        (outfile req'd, same as "-pdf outfile -pdfprofile PDF/A-1b")
+      -awt              input will be displayed on screen
+      -rtf outfile      input will be rendered as RTF (outfile req'd)
+      -pcl outfile      input will be rendered as PCL (outfile req'd)
+      -ps outfile       input will be rendered as PostScript (outfile req'd)
+      -afp outfile      input will be rendered as AFP (outfile req'd)
+      -tiff outfile     input will be rendered as TIFF (outfile req'd)
+      -png outfile      input will be rendered as PNG (outfile req'd)
+      -txt outfile      input will be rendered as plain text (outfile req'd)
+      -at [mime] out    representation of area tree as XML (outfile req'd)
+                        specify optional mime output to allow the AT to be converted
+                        to final format later
+      -if [mime] out    representation of document in intermediate format XML (outfile req'd)
+                        specify optional mime output to allow the IF to be converted
+                        to final format later
+      -print            input file will be rendered and sent to the printer
+                        see options with "-print help"
+      -out mime outfile input will be rendered using the given MIME type
+                        (outfile req'd) Example: "-out application/pdf D:\out.pdf"
+                        (Tip: "-out list" prints the list of supported MIME types)
+      -svg outfile      input will be rendered as an SVG slides file (outfile req'd)
+                        Experimental feature - requires additional fop-sandbox.jar.
+
+      -foout outfile    input will only be XSL transformed. The intermediate
+                        XSL-FO file is saved and no rendering is performed.
+                        (Only available if you use -xml and -xsl parameters)
+
+
+     [Examples]
+      fop foo.fo foo.pdf
+      fop -fo foo.fo -pdf foo.pdf (does the same as the previous line)
+      fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf
+      fop -xml foo.xml -xsl foo.xsl -foout foo.fo
+      fop -xml - -xsl foo.xsl -pdf -
+      fop foo.fo -mif foo.mif
+      fop foo.fo -rtf foo.rtf
+      fop foo.fo -print
+      fop foo.fo -awt
+
+PDF encryption is only available if FOP was compiled with encryption support **and** if compatible
encryption support is available at run time. Currently, only the JCE is supported. Check the
[Details](pdfencryption.html).
+
+### Writing your own script { #your-own-script}
+
+FOP's entry point for your own scripts is the class `org.apache.fop.cli.Main`. The general
pattern for the command line is: `java -classpath <CLASSPATH>
+        org.apache.fop.cli.Main <arguments>`. The arguments consist of the options
and infile and outfile specifications as shown above for the standard scripts. You may wish
to review the standard scripts to make sure that you get your environment properly configured.
+
+### Running with java's -jar option { #jar-option}
+
+As an alternative to the start scripts you can run `java
+        -jar path/to/build/fop.jar <arguments>`, relying on FOP to build the classpath
for running FOP dynamically, see [below](#dynamical-classpath). If you use hyphenation, you
must put `fop-hyph.jar` in the `lib` directory.
+
+You can also run `java -jar path/to/fop.jar
+      <arguments>`, relying on the `Class-Path` entry in the manifest file. This works
if you put `fop.jar` and all jar files from the `lib` directory in a single directory. If
you use hyphenation, you must also put `fop-hyph.jar` in that directory.
+
+In both cases the arguments consist of the options and infile and outfile specifications
as shown above for the standard scripts.
+
+### FOP's dynamical classpath construction { #dynamical-classpath}
+
+If FOP is started without a proper classpath, it tries to add its dependencies dynamically.
If the system property `fop.home` contains the name of a directory, then FOP uses that directory
as the base directory for its search. Otherwise the current working directory is the base
directory. If the base directory is called `build`, then its parent directory becomes the
base directory.
+
+FOP expects to find `fop.jar` in the `build` subdirectory of the base directory, and adds
it to the classpath. Subsequently FOP adds all `jar` files in the lib directory to the classpath.
The lib directory is either the `lib` subdirectory of the base directory, or, if that does
not exist, the base directory itself.
+
+If the system property `fop.optional.lib` contains the name of a directory, then all `jar`
files in that directory are also added to the classpath. See the methods `getJARList` and
`checkDependencies` in `org.apache.fop.cli.Main`.
+
+## Using Xalan to Check XSL-FO Input { #check-input}
+
+FOP sessions that use -xml and -xsl input instead of -fo input are actually controlling two
distinct conversions: Tranforming XML to XSL-FO, then formatting the XSL-FO to PDF (or another
FOP output format). Although FOP controls both of these processes, the first is included merely
as a convenience and for performance reasons. Only the second is part of FOP's core processing.
If a user has a problem running FOP, it is important to determine which of these two processes
is causing the problem. If the problem is in the first process, the user's stylesheet is likely
the cause. The FOP development team does not have resources to help with stylesheet issues,
although we have included links to some useful [Specifications](../resources.html#specs) and
[Books/Articles](../resources.html#articles). If the problem is in the second process, FOP
may have a bug or an unimplemented feature that does require attention from the FOP development
team.
+
+<note>The user is always responsible to provide correct XSL-FO code to FOP.</note>
+
+In the case of using -xml and -xsl input, although the user is responsible for the XSL-FO
code that is FOP's input, it is not visible to the user. To make the intermediate FO file
visible, the FOP distribution includes the "-foout" option which causes FOP to run only the
first (transformation) step, and write the results to a file. (See also the Xalan command-line
below)
+
+<note>When asking for help on the FOP mailing lists, *never* attach XML and XSL to
illustrate the issue. Always run the XSLT step (-foout) and send the resulting XSL-FO file
instead. Of course, be sure that the XSL-FO file is correct before sending it.</note>
+
+The -foout option works the same way as if you would call the [Xalan command-line](http://xml.apache.org/xalan-j/commandline.html):
+
+ `java org.apache.xalan.xslt.Process -IN xmlfile -XSL file -OUT outfile`
+
+Note that there are some subtle differences between the FOP and Xalan command-lines.
+
+## Memory Usage { #memory}
+
+FOP can consume quite a bit of memory, even though this has been continually improved. This
is partly inherent to the formatting process and partly caused by implementation choices.
All FO processors currently on the market have memory problems with certain layouts.
+
+If you are running out of memory when using FOP, here are some ideas that may help:
+
+
+- Increase memory available to the JVM. See [the -Xmx option](http://docs.oracle.com/javase/1.5.0/docs/tooldocs/solaris/java.html)
for more information.<warning>It is usually unwise to increase the memory allocated
to the JVM beyond the amount of physical RAM, as this will generally cause significantly slower
performance.</warning>
+
+- Avoid forward references. Forward references are references to some later part of a document.
Examples include page number citations which refer to pages which follow the citation, tables
of contents at the beginning of a document, and page numbering schemes that include the total
number of pages in the document (["page N of TOTAL"](../faq.html#pagenum)). Forward references
cause all subsequent pages to be held in memory until the reference can be resolved, i.e.
until the page with the referenced element is encountered. Forward references may be required
by the task, but if you are getting a memory overflow, at least consider the possibility of
eliminating them. A table of contents could be replaced by PDF bookmarks instead or moved
to the end of the document (reshuffle the paper could after printing).
+
+- Avoid large images, especially if they are scaled down. If they need to be scaled, scale
them in another application upstream from FOP. For many image formats, memory consumption
is driven mainly by the size of the image file itself, not its dimensions (width*height),
so increasing the compression rate may help.
+
+- Use multiple page sequences. FOP starts rendering after the end of a page sequence is encountered.
While the actual rendering is done page-by-page, some additional memory is freed after the
page sequence has been rendered. This can be substantial if the page sequence contains lots
of FO elements.
+
+## Problems { #problems}
+
+If you have problems running FOP, please see the ["How to get Help" page](../gethelp.html).

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

Added: xmlgraphics/site/trunk/content/fop/2.2/servlets.mdtext
URL: http://svn.apache.org/viewvc/xmlgraphics/site/trunk/content/fop/2.2/servlets.mdtext?rev=1787787&view=auto
==============================================================================
--- xmlgraphics/site/trunk/content/fop/2.2/servlets.mdtext (added)
+++ xmlgraphics/site/trunk/content/fop/2.2/servlets.mdtext Mon Mar 20 14:52:17 2017
@@ -0,0 +1,207 @@
+Title: Apache(tm) FOP: Servlets
+
+#Apache&trade; FOP: Servlets
+<subtitle>How to use Apache&trade; FOP in a Servlet</subtitle>
+
+## Overview { #overview}
+
+This page discusses topic all around using Apache&trade; FOP in a servlet environment.
+
+## Example Servlets in the FOP distribution { #example-servlets}
+
+In the directory {fop-dir}/fop-core/src/main/java/org/apache/fop/servlet, you'll find a working
example of a FOP-enabled servlet.
+
+The servlet is automatically built when you build Apache FOP using the supplied Ant script.
After building the servlet, drop fop.war into the webapps directory of Apache Tomcat (or any
other web container). Then, you can use URLs like the following to generate PDF files:
+
+
+- http://localhost:8080/fop/fop?fo=/home/path/to/fofile.fo
+
+- http://localhost:8080/fop/fop?xml=/home/path/to/xmlfile.xml&xsl=/home/path/to/xslfile.xsl
+
+
+
+The source code for the servlet can be found under {fop-dir}/fop-core/src/main/java/org/apache/fop/servlet/FopServlet.java.
+
+<note>This example servlet should not be used on a public web server connected to the
Internet as it does not contain any measures to prevent Denial-of-Service-Attacks. It is provided
as an example and as a starting point for your own servlet.</note>
+
+## Create your own Servlet { #servlet}
+
+<note>This section assumes you are familiar with [embedding FOP](embedding.html).</note>
+
+### A minimal Servlet { #minimal-servlet}
+
+Here is a minimal code snippet to demonstrate the basics:
+
+    :::java
+    private TransformerFactory tFactory = TransformerFactory.newInstance();
+
+    public void doGet(HttpServletRequest request,
+                       HttpServletResponse response) throws ServletException {
+        try {
+            response.setContentType("application/pdf");
+            FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI());
+            Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, response.getOutputStream());
+            Transformer transformer = tFactory.newTransformer();
+            Source src = new StreamSource("foo.fo");
+            Result res = new SAXResult(fop.getDefaultHandler());
+            transformer.transform(src, res);
+        } catch (Exception ex) {
+            throw new ServletException(ex);
+        }
+    }
+
+<note>There are numerous problems with the code snippet above. Its purpose is only
to demonstrate the basic concepts. See below for details.</note>
+
+### Adding XSL tranformation (XSLT) { #xslt}
+
+A common requirement is to transform an XML source to XSL-FO using an XSL transformation.
It is recommended to use JAXP for this task. The following snippet shows the basic code:
+
+    :::java
+    private TransformerFactory tFactory = TransformerFactory.newInstance();
+
+    public void init() throws ServletException {
+        //Optionally customize the FopFactory and TransformerFactory here
+    }
+
+    [..]
+
+    FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI());
+
+    //Setup a buffer to obtain the content length
+    ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+    //Setup FOP
+    Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out);
+
+    //Setup Transformer
+    Source xsltSrc = new StreamSource(new File("foo-xml2fo.xsl"));
+    Transformer transformer = tFactory.newTransformer(xsltSrc);
+
+    //Make sure the XSL transformation's result is piped through to FOP
+    Result res = new SAXResult(fop.getDefaultHandler());
+
+    //Setup input
+    Source src = new StreamSource(new File("foo.xml"));
+
+    //Start the transformation and rendering process
+    transformer.transform(src, res);
+
+    //Prepare response
+    response.setContentType("application/pdf");
+    response.setContentLength(out.size());
+
+    //Send content to Browser
+    response.getOutputStream().write(out.toByteArray());
+    response.getOutputStream().flush();
+
+<note>Buffering the generated PDF in a ByteArrayOutputStream is done to avoid potential
problems with the Acrobat Reader Plug-in in Microsoft Internet Explorer.</note>
+
+The `Source` instance used above is simply an example. If you have to read the XML from a
string, supply a `new StreamSource(new
+          StringReader(xmlstring))`. Constructing and reparsing an XML string is generally
less desirable than using a SAXSource if you generate your XML. You can alternatively supply
a DOMSource as well. You may also use dynamically generated XSL if you like.
+
+Because you have an explicit `Transformer` object, you can also use it to explicitely set
parameters for the transformation run.
+
+### Custom configuration { #cfg}
+
+You can easily set up your own FOUserAgent as demonstrated on the [Embedding page](embedding.html).
+
+### Improving performance { #performance}
+
+There are several options to consider:
+
+
+- Instead of java.io.ByteArrayOutputStream consider using the ByteArrayOutputStream implementation
from the [Jakarta Commons IO project](http://commons.apache.org/io/) which allocates less
memory. The full class name is: `org.apache.commons.io.output.ByteArrayOutputStream`
+
+- In certain cases it can help to write the generated PDF to a temporary file so you can
quickly reuse the file. This is especially useful, if Internet Explorer calls the servlet
multiple times with the same request or if you often generate equal PDFs.
+
+Of course, the [performance hints from the Embedding page](embedding.html#performance) apply
here, too.
+
+### Accessing resources in your web application { #uriresolver}
+
+Often, you will want to use resources (stylesheets, images etc.) which are bundled with your
web application. FOP provides a URIResolver implementation that lets you access files via
the Servlet's ServletContext. The class is called `org.apache.fop.servlet.ServletContextURIResolver`.
+
+Here's how to set it up in your servlet. Instantiate a new instance in the servlet's init()
method:
+
+    :::java
+    /** URIResolver for use by this servlet */
+    protected URIResolver uriResolver;
+
+    public void init() throws ServletException {
+        this.uriResolver = new ServletContextURIResolver(getServletContext());
+        [..]
+    }
+
+The ServletContextURIResolver reacts on URIs beginning with "servlet-context:". If you want
to access an image in a subdirectory of your web application, you could, for example, use:
"servlet-context:/images/myimage.png". Don't forget the leading slash after the colon!
+
+Further down, you can use the URIResolver for various things:
+
+
+- With the Transformer (JAXP/XSLT) so things like document() functions can resolver "servlet-context:"
URIs.
+
+- With the FopFactory so every resource FOP loads can be loaded using a "servlet-context:"
URI.
+
+- You can the ServletContextURIResolver yourself in your servlet code to access stylesheets
or XML files bundled with your web application.
+
+Here are some example snippets:
+
+    :::java
+    //Setting up the JAXP TransformerFactory
+    this.transFactory = TransformerFactory.newInstance();
+    this.transFactory.setURIResolver(this.uriResolver);
+
+    [..]
+    
+     ResourceResolver resolver = new ResourceResolver() {
+            public OutputStream getOutputStream(URI uri) throws IOException {
+                URL url = getServletContext().getResource(uri.toASCIIString());
+                return url.openConnection().getOutputStream();
+            }
+
+            public Resource getResource(URI uri) throws IOException {
+                return new Resource(getServletContext().getResourceAsStream(uri.toASCIIString()));
+            }
+        };
+    
+    //Setting up the FOP factory
+    FopFactoryBuilder builder = new FopFactoryBuilder(new File(".").toURI(), resolver);
+    fopFactory = builder.build();
+
+    [..]
+
+    //The stylesheet for the JAXP Transfomer
+    Source xsltSrc = this.uriResolver.resolve(
+        "servlet-context:/xslt/mystylesheet.xsl", null);
+    Transformer transformer = this.transFactory.newTransformer(xsltSrc);
+    transformer.setURIResolver(this.uriResolver);
+
+## Notes on Microsoft Internet Explorer { #ie}
+
+Some versions of Internet Explorer will not automatically show the PDF or call the servlet
multiple times. These are well-known limitations of Internet Explorer and are not a problem
of the servlet. However, Internet Explorer can still be used to download the PDF so that it
can be viewed later. Here are some suggestions in this context:
+
+
+- Use an URL ending in `.pdf`, like `http://myserver/servlet/stuff.pdf`. Yes, the servlet
can be configured to handle this. If the URL has to contain parameters, try to have **both**
the base URL as well as the last parameter end in `.pdf`, if necessary append a dummy parameter,
like `http://myserver/servlet/stuff.pdf?par1=a&par2=b&d=.pdf`. The effect may depend
on IEx version.
+
+- Give IEx the opportunity to cache. In particular, ensure the server does not set any headers
causing IEx not to cache the content. This may be a real problem if the document is sent over
HTTPS, because most IEx installations will by default *not* cache any content retrieved over
HTTPS. Setting the `Expires` header entry may help in this case:
+
+        :::java
+        response.setDateHeader("Expires", System.currentTimeMillis() + cacheExpiringDuration
* 1000);
+
+    Consult your server manual and the relevant RFCs for further details on HTTP headers
and caching.
+
+- Cache in the server. It may help to include a parameter in the URL which has a timestamp
as the value min order to decide whether a request is repeated. IEx is reported to retrieve
a document up to three times, but never more often.
+
+## Servlet Engines { #servlet-engine}
+
+When using a servlet engine, there are potential CLASSPATH issues, and potential conflicts
with existing XML/XSLT libraries. Servlet containers also often use their own classloaders
for loading webapps, which can cause bugs and security problems.
+
+### Tomcat { #tomcat}
+
+Check Tomcat's documentation for detailed instructions about installing FOP and Cocoon. There
are known bugs that must be addressed, particularly for Tomcat 4.0.3.
+
+### WebSphere 3.5 { #websphere}
+
+Put a copy of a working parser in some directory where WebSphere can access it. For example,
if /usr/webapps/yourapp/servlets is the CLASSPATH for your servlets, copy the Xerces jar into
it (any other directory would also be fine). Do not add the jar to the servlet CLASSPATH,
but add it to the CLASSPATH of the application server which contains your web application.
In the WebSphere administration console, click on the "environment" button in the "general"
tab. In the "variable name" box, enter "CLASSPATH". In the "value" box, enter the correct
path to the parser jar file (/usr/webapps/yourapp/servlets/Xerces.jar in our example here).
Press "OK", then apply the change and restart the application server.
+
+## Handling complex use cases { #complex-usecases}
+
+Sometimes the requirements for a servlet get quite sophisticated: SQL data sources, multiple
XSL transformations, merging of several datasources etc. In such a case consider using [Apache
Cocoon](http://cocoon.apache.org/) instead of a custom servlet to accomplish your goal.

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

Added: xmlgraphics/site/trunk/content/fop/2.2/upgrading.mdtext
URL: http://svn.apache.org/viewvc/xmlgraphics/site/trunk/content/fop/2.2/upgrading.mdtext?rev=1787787&view=auto
==============================================================================
--- xmlgraphics/site/trunk/content/fop/2.2/upgrading.mdtext (added)
+++ xmlgraphics/site/trunk/content/fop/2.2/upgrading.mdtext Mon Mar 20 14:52:17 2017
@@ -0,0 +1,111 @@
+Title: Upgrading from an Earlier Version of Apache&trade; FOP
+
+#Upgrading from an Earlier Version of Apache&trade; FOP
+
+## Upgrading from Version 1.1
+
+When upgrading from 1.x or earlier version of fop there are some significant changes that
the user must be aware of:
+
+FOUriResolver and FOPFactoryConfigurator classes have been removed
+
+In their place, the following classes have been added: 
+
+- InternalResourceResolver
+- ResourceResolverFactory  
+- FopConfParser  (parses the configuration file and returns a FOPFactoryBuilder instance)

+- FOPFactoryBuilder (a builder class that can be used for setting Configuration) 
+
+Instead of configuring the FOPFactory you can use the above classes: 
+
+    :::xml
+    File xconf = new File("fop.xconf"); 
+    FopConfParser parser = new FopConfParser(xconf); //parsing configuration  
+    FopFactoryBuilder builder = parser.getFopFactoryBuilder(); //building the factory with
the user options
+    FOPFactory fopFactory = builder.build();
+    Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
+ 
+or equally reading from an xml file
+
+    :::xml
+    DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
+    Configuration cfg = cfgBuilder.buildFromFile(new File("mycfg.xml"));
+    fopFactoryBuilder = new FopFactoryBuilder(baseURI).setConfiguration(cfg);
+      
+The above can be used instead of fopFactory.setUserConfig(cfg) which is not available anymore.

+
+Another important change is the way FOP resolves URI.
+Class FOURIResolver has been replaced with InternalResourceResolver (holds a reference to
both the ResourceResolver needed for resource acquisition and the base URI from which to resolve
URI's).
+ResourceResolverFactory (a factory class for Resource resolver).
+
+Use of custom resource resolvers is now available through the use of FopFactoryBuilder.
+
+    :::xml
+    FopFactoryBuilder builder = new FopFactoryBuilder(new File(".").toURI(), resolver);
+
+resolver is an object of org.apache.xmlgraphics.io.ResourceResolver.
+
+Instead of fopFactory.setURIResolver(uriResolver);  where uriResolver is an object of URIResolver.
+
+More information on how to configure Apache FOP programmatically and customizing the User
Agent can be found in [embedding](embedding.html)
+
+Moreover more information on providing org.apache.xmlgraphics.io.ResourceResolver for custom
URI resolution can be found in [servlets](servlets.html)
+
+
+## Upgrading from Version 1.0 { #fop-1.0}
+
+You should encounter very few issues in upgrading from FOP 1.0, except as noted in the following:
+
+- The intermediate format (IF) output format has underwent minor modification as follows:
+
+    - In order to track changes to the IF format, a `version` attribute has been added to
the root `document` element. Since no version information was provided previously, the initial
value of this attribute is `2.0`. Future backward compatible changes will update the minor
version number, while future non-backward compatible changes will update the major version
number.
+
+    - On the `text` element, a new alternate representation is used for adjustments to glyph
positions as expressed by a `dp` attribute instead of the `dx` attribute. For further information,
see [complex script patch - intermediate format changes](http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-dev/201202.mbox/%3cCACQ=j+evStXx=7hW=CHVNKCrZHUso9FHZCSk_5EoENOHcGpGOg@mail.gmail.com%3e).
+
+    - On the `border-rect` element, the attributes { `before`, `after`, `start`, `end` }
have been renamed to { `top`, `bottom`, `left`, `right` }, respectively. For further information,
see [complex script patch - intermediate format changes](http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-dev/201202.mbox/%3cCACQ=j+evStXx=7hW=CHVNKCrZHUso9FHZCSk_5EoENOHcGpGOg@mail.gmail.com%3e).
+
+- The `IFPainter` interface (of package `org.apache.fop.render.intermediate`), specifically
the `drawText` and `drawBorderRect` method signatures, have been modified to express the semantics
of the above changes to the IF output format.
+
+- The area tree (AT) output format has underwent minor modification as follows:
+
+    - In order to track changes to the AT format, a `version` attribute has been added to
the root `areaTree` element. Since no version information was provided previously, the initial
value of this attribute is `2.0`. Future backward compatible changes will update the minor
version number, while future non-backward compatible changes will update the major version
number.
+
+    - An optional `level` attribute has been added to a number of element types to express
resolved bidirectional level.
+
+    - An optional `reversed` attribute has been added to the `word` element type to express
that the glyphs that correspond to the character content of the element should be reversed
(in order) in the inline progression dimension when rendering.
+
+- Because complex script features are now enabled by default, it is possible that different
font specific data will be used for kerning than was previously used. This may be the case
if a font supports a traditional TrueType `kern` table and also supports the advanced typographic
`kern` feature with a `GPOS` table. In FOP 1.0, the former is used for kerning, while in FOP
1.1 with complex script features enabled, the latter is used. If it is desired to explicitly
use the `kern` table (rather than the `GPOS` table) in such a case, then the `-nocs` command
line option may be used when invoking FOP in order to disable complex script features.
+
+## Upgrading from Pre-1.0 Versions { #pre-1.0}
+
+If you're planning to upgrade to the latest Apache&trade; FOP version from a pre-1.0
version, there are a few very important things to consider:
+
+- The API of FOP has changed considerably and is not backwards-compatible with versions 0.20.5
and 0.91beta. Version 0.92 introduced the **new stable API**.
+
+- Since version 0.92 some deprecated methods which were part of the old API have been removed.
If you upgrade from 0.91 beta, you will need to adjust your Java code. Similarly if you upgrade
from 0.92 and use deprecated methods.
+
+- If you are using a configuration file for version 0.20.5, you have to rebuild it in the
new format. The format of the configuration files has changed since version 0.20.5. See conf/fop.xconf
for an example configuration file. A XML Schema file can be found under src/foschema/fop-configuration.xsd.
+
+- Beginning with version 0.94 you can skip the generation of font metric files and remove
the "font-metrics" attribute in the font configuration. In the unlikely case that due to a
bug you still need to use font metrics files you will need to regenerate the font metrics
file if yours are from a FOP version before 0.93.
+
+- The new code is much more strict about the interpretation of the XSL-FO specification.
Things that worked fine in version 0.20.5 might start to produce warnings or even errors now.
FOP 0.20.5 contains many bugs which have been corrected in the new code.
+
+    <note>While FOP 0.20.5 allowed you to have empty `fo:table-cell` elements, the
new code will complain about that (unless relaxed validation is enabled) because the specification
demands at least one block-level element (`(%block;)+`, see [XSL-FO 1.1, 6.7.10](http://www.w3.org/TR/xsl/#fo_table-cell))
inside an `fo:table-cell` element.</note>
+
+- Extensions and Renderers written for version 0.20.5 will not work with the new code! The
new FOP extension for [Barcode4J](http://barcode4j.sourceforge.net) is available since January
2007.
+
+- The SVG Renderer and the MIF Handler have not yet been resurrected! They are currently
non-functional and hope for someone to step up and reimplement them.
+
+When you use your existing FO files or XML/XSL files which work fine with FOP version 0.20.5
against this FOP version some things may not work as expected. The following list will hopefully
help you to identify and correct those problems.
+
+
+- Check the [Compliance page](../compliance.html) for the feature causing trouble. It may
contain the necessary information to understand and resolve the problem.
+
+- Not all 0.20.5 output formats are supported. PDF and Postscript should be fully supported.
See [Output Targets](output.html) for a more complete description.
+
+- As stated above, empty table cells `<fo:table-cell></fo:table-cell>` are not
allowed by the specification. The same applies to empty `fo:static-content` and `fo:block-container`
elements, for example.
+
+- Version 0.20.5 is not XSL-FO compliant with respect to sizing images (`external-graphic`)
or `instream-foreign-object` objects. If images or SVGs are sized differently in your outputs
with the new FOP version check [FOP-1073](https://issues.apache.org/jira/browse/FOP-1073)
as it contains some hints on what to do. The file [http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/fop/examples/fo/basic/images.fo?view=markup](http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/fop/examples/fo/basic/images.fo?view=markup)
has a number of good examples that show the correct behaviour.
+
+- The `fox:outline` extension is not implemented in the current version: it has been superseded
by the bookmark elements from XSL-FO 1.1.
+
+- The `fox:continued-label` extension is not implemented in this version anymore. It has
been superseded by the `fo:retrieve-table-marker` element from XSL-FO 1.1.
\ No newline at end of file

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

Added: xmlgraphics/site/trunk/content/fop/2.2/whitespacemanagement.mdtext
URL: http://svn.apache.org/viewvc/xmlgraphics/site/trunk/content/fop/2.2/whitespacemanagement.mdtext?rev=1787787&view=auto
==============================================================================
--- xmlgraphics/site/trunk/content/fop/2.2/whitespacemanagement.mdtext (added)
+++ xmlgraphics/site/trunk/content/fop/2.2/whitespacemanagement.mdtext Mon Mar 20 14:52:17
2017
@@ -0,0 +1,43 @@
+Title:     Apache(th) FOP: Whitespace Management
+Notice:    Licensed to the Apache Software Foundation (ASF) under one
+           or more contributor license agreements.  See the NOTICE file
+           distributed with this work for additional information
+           regarding copyright ownership.  The ASF licenses this file
+           to you under the Apache License, Version 2.0 (the
+           "License"); you may not use this file except in compliance
+           with the License.  You may obtain a copy of the License at
+           .
+             http://www.apache.org/licenses/LICENSE-2.0
+           .
+           Unless required by applicable law or agreed to in writing,
+           software distributed under the License is distributed on an
+           "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+           KIND, either express or implied.  See the License for the
+           specific language governing permissions and limitations
+           under the License.
+
+#Apache&trade; FOP: Whitespace Management
+
+## Overview { #overview}
+
+This page describes an extension for FOP’s page breaking algorithm that enables the
handling of dynamic content. Dynamic content has multiple variants, only one of which will
be inserted in the document. Variant selection is done in a First Come First Served manner
and the first variant that fits within the remaining space in the current page is chosen.
If no appropriate variant is found, the dynamic content will be skipped without affecting
the rest of the document layout.
+
+## Example { #example}
+
+Here is an example of dynamic content with two variants:
+
+    :::xml
+    <fo:multi-switch fox:auto-toggle="select-first-fitting" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">
+		<fo:multi-case>
+		    <fo:block>First variant</fo:block>
+		</fo:multi-case>
+		<fo:multi-case>
+		    <fo:block>Second variant</fo:block>
+		</fo:multi-case>
+	</fo:multi-switch>
+
+## Limitations { #limitations}
+
+* Space attributes (space-before, space-after) are not currently supported. This is primarily
due to how space resolution is done in FOP, which requires the whole FO content to be known
before doing page breaking.
+
+* Dynamic content inside a table cell does not work.

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



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


Mime
View raw message