org.apache.fop.apps

Class Fop


public class Fop
extends java.lang.Object

Primary class that activates the FOP process for embedded usage.

JAXP is the standard method of embedding FOP in Java programs. Please check our embedding page for samples (these are also available within the distribution in FOP_DIR\examples\embedding)

Methods within FOUserAgent are available to customize portions of the process. For example, a specific Renderer object can be specified, also ElementMappings which determine elements in the FO that can be processed) can be added.

At the moment, it is recommended not to reuse an instance of this class for more than one rendering run.

Constructor Summary

Fop(String outputFormat)
Deprecated. End-users should use FopFactory.newFop(String) instead! This constructor will become invisible with FOP 1.0.
Fop(String outputFormat, FOUserAgent ua)
Deprecated. End-users should use FopFactory.newFop(String,FOUserAgent) instead! This constructor will become invisible with FOP 1.0.
Fop(String outputFormat, FOUserAgent ua, OutputStream stream)
Deprecated. End-users should use FopFactory.newFop(String,FOUserAgent,OutputStream) instead! This constructor will become invisible with FOP 1.0.

Method Summary

DefaultHandler
getDefaultHandler()
Returns the DefaultHandler object used to generate the document.
FormattingResults
getResults()
Returns the results of the rendering process.
FOUserAgent
getUserAgent()
Get the FOUserAgent instance for this process
static String
getVersion()
Deprecated. Use Version.getVersion() instead! This method will be removed with FOP 1.0.
void
setOutputStream(OutputStream stream)
Deprecated. Use one of the factory methods on FopFactory with an OutputStream parameter instead.

Constructor Details

Fop

public Fop(String outputFormat)

Deprecated. End-users should use FopFactory.newFop(String) instead! This constructor will become invisible with FOP 1.0.

Constructor for FOP with a default FOUserAgent. It uses MIME types to select the output format (ex. "application/pdf" for PDF).
Parameters:
outputFormat - the MIME type of the output format to use (ex. "application/pdf").

Fop

public Fop(String outputFormat,
           FOUserAgent ua)
            throws FOPException

Deprecated. End-users should use FopFactory.newFop(String,FOUserAgent) instead! This constructor will become invisible with FOP 1.0.

Constructor for use with already-created FOUserAgents. It uses MIME types to select the output format (ex. "application/pdf" for PDF).
Parameters:
outputFormat - the MIME type of the output format to use (ex. "application/pdf").
ua - FOUserAgent object
Throws:
FOPException - if setting up the DefaultHandler fails

Fop

public Fop(String outputFormat,
           FOUserAgent ua,
           OutputStream stream)
            throws FOPException

Deprecated. End-users should use FopFactory.newFop(String,FOUserAgent,OutputStream) instead! This constructor will become invisible with FOP 1.0.

Constructor for use with already-created FOUserAgents. It uses MIME types to select the output format (ex. "application/pdf" for PDF).
Parameters:
outputFormat - the MIME type of the output format to use (ex. "application/pdf").
ua - FOUserAgent object
stream - the output stream
Throws:
FOPException - if setting up the DefaultHandler fails

Method Details

getDefaultHandler

public DefaultHandler getDefaultHandler()
            throws FOPException
Returns the DefaultHandler object used to generate the document. Checking for null and the exception is only for the deprecated constructor.
Returns:
the SAX DefaultHandler for handling the SAX events.
Throws:
FOPException - if setting up the DefaultHandler fails

getResults

public FormattingResults getResults()
Returns the results of the rendering process. Information includes the total number of pages generated and the number of pages per page-sequence. Call this method only after the rendering process is finished. Note that the results are only available for output formats which make use of FOP's layout engine (PDF, PS, etc.).
Returns:
the results of the rendering process, or null for flow-oriented output formats like RTF and MIF.

getUserAgent

public FOUserAgent getUserAgent()
Get the FOUserAgent instance for this process
Returns:
the user agent

getVersion

public static String getVersion()

Deprecated. Use Version.getVersion() instead! This method will be removed with FOP 1.0.

Get the version of FOP
Returns:
the version string

setOutputStream

public void setOutputStream(OutputStream stream)

Deprecated. Use one of the factory methods on FopFactory with an OutputStream parameter instead. This method will be removed with FOP 1.0.

Set the OutputStream to use to output the result of the Render (if applicable)
Parameters:
stream - the stream to output the result of rendering to

Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.