Package org.apache.fop.apps
Class Fop
- java.lang.Object
-
- org.apache.fop.apps.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.
-
-
Field Summary
Fields Modifier and Type Field Description private FOTreeBuilder
foTreeBuilder
private FOUserAgent
foUserAgent
private java.lang.String
outputFormat
private java.io.OutputStream
stream
-
Constructor Summary
Constructors Constructor Description Fop(java.lang.String outputFormat, FOUserAgent ua, java.io.OutputStream stream)
Constructor for use with already-created FOUserAgents.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private void
createDefaultHandler()
Creates a DefaultHandler object used to generate the document.org.xml.sax.helpers.DefaultHandler
getDefaultHandler()
Returns the DefaultHandler object that will receive the SAX stream containing the FO document to be rendered.FormattingResults
getResults()
Returns the results of the rendering process.FOUserAgent
getUserAgent()
Deprecated.this getter doesn't need to exist.
-
-
-
Field Detail
-
outputFormat
private java.lang.String outputFormat
-
stream
private java.io.OutputStream stream
-
foUserAgent
private final FOUserAgent foUserAgent
-
foTreeBuilder
private FOTreeBuilder foTreeBuilder
-
-
Constructor Detail
-
Fop
Fop(java.lang.String outputFormat, FOUserAgent ua, java.io.OutputStream stream) throws FOPException
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 objectstream
- the output stream- Throws:
FOPException
- if setting up the DefaultHandler fails
-
-
Method Detail
-
getUserAgent
public FOUserAgent getUserAgent()
Deprecated.this getter doesn't need to exist. By virtue of the fact that the client has an instance of this object, it means they also have theFOUserAgent
since this's constructor is only used inFOUserAgent
Get the FOUserAgent instance associated with the rendering run represented by this instance.- Returns:
- the user agent
-
createDefaultHandler
private void createDefaultHandler() throws FOPException
Creates a DefaultHandler object used to generate the document. Note this object implements the ContentHandler interface. For processing with a Transformer object, this DefaultHandler object can be used in the SAXResult constructor. Alternatively, for processing with a SAXParser, this object can be used as the DefaultHandler argument to its parse() methods.- Throws:
FOPException
- if setting up the DefaultHandler fails
-
getDefaultHandler
public org.xml.sax.helpers.DefaultHandler getDefaultHandler() throws FOPException
Returns the DefaultHandler object that will receive the SAX stream containing the FO document to be rendered.- 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.
-
-