org.apache.fop.apps
public class: Fop [javadoc |
source]
java.lang.Object
org.apache.fop.apps.Fop
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: |
Fop(String outputFormat,
FOUserAgent ua,
OutputStream stream) throws FOPException {
this.outputFormat = outputFormat;
foUserAgent = ua;
if (foUserAgent == null) {
foUserAgent = FopFactory.newInstance().newFOUserAgent();
}
this.stream = stream;
createDefaultHandler();
}
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 from org.apache.fop.apps.Fop Detail: |
public DefaultHandler getDefaultHandler() throws FOPException {
if (foTreeBuilder == null) {
createDefaultHandler();
}
return this.foTreeBuilder;
}
Returns the DefaultHandler object that will receive the SAX stream containing the
FO document to be rendered. |
public FormattingResults getResults() {
if (foTreeBuilder == null) {
throw new IllegalStateException(
"Results are only available after calling getDefaultHandler().");
} else {
return foTreeBuilder.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.). |
public FOUserAgent getUserAgent() {
return foUserAgent;
}
Get the FOUserAgent instance associated with the rendering run represented by this instance. |