Factory class which instantiates new Fop and FOUserAgent instances. This
class also holds environmental information and configuration used by FOP.
Information that may potentially be different for each rendering run can be
found and managed in the FOUserAgent.
addElementMapping
public void addElementMapping(ElementMapping elementMapping)
Add the element mapping with the given class name.
elementMapping
- the class name representing the element mapping.
getBaseURL
public String getBaseURL()
Returns the base URL.
getColorSpace
public ColorSpace getColorSpace(String baseUri,
String iccProfileSrc)
Create (if needed) and return an ICC ColorSpace instance.
The ICC profile source is taken from the src attribute of the color-profile FO element.
If the ICC ColorSpace is not yet in the cache a new one is created and stored in the cache.
The FOP URI resolver is used to try and locate the ICC file.
If that fails null is returned.
baseUri
- a base URI to resolve relative URIsiccProfileSrc
- ICC Profile source to return a ColorSpace for
- ICC ColorSpace object or null if ColorSpace could not be created
getElementMappingRegistry
public ElementMappingRegistry getElementMappingRegistry()
- the element mapping registry
getFontBaseURL
public String getFontBaseURL()
getFontCache
public FontCache getFontCache()
Returns the font cache instance used by this factory.
getHyphenBaseURL
public String getHyphenBaseURL()
getHyphenationTreeResolver
public HyphenationTreeResolver getHyphenationTreeResolver()
- the HyphenationTreeResolver for resolving user-supplied hyphenation patterns.
getIgnoredNamespace
public Set getIgnoredNamespace()
- the set of namespaces that are ignored by FOP
getImageManager
public ImageManager getImageManager()
Returns the image manager.
getLayoutManagerMakerOverride
public LayoutManagerMaker getLayoutManagerMakerOverride()
Returns the overriding LayoutManagerMaker instance, if any.
- the overriding LayoutManagerMaker or null
getPageHeight
public String getPageHeight()
Gets the default page-height to use as fallback,
in case page-height="auto"
- the page-height, as a String
getPageWidth
public String getPageWidth()
Gets the default page-width to use as fallback,
in case page-width="auto"
- the page-width, as a String
getSourcePixelUnitToMillimeter
public float getSourcePixelUnitToMillimeter()
Returns the conversion factor from pixel units to millimeters. This
depends on the desired source resolution.
getSourceResolution
public float getSourceResolution()
- the resolution for resolution-dependant input
getTargetPixelUnitToMillimeter
public float getTargetPixelUnitToMillimeter()
Returns the conversion factor from pixel units to millimeters. This
depends on the desired target resolution.
getTargetResolution
public float getTargetResolution()
- the resolution for resolution-dependant output
getURIResolver
public URIResolver getURIResolver()
Returns the URI Resolver.
getUserConfig
public Configuration getUserConfig()
Get the user configuration.
ignoreNamespace
public void ignoreNamespace(String namespaceURI)
Adds a namespace to the set of ignored namespaces.
If FOP encounters a namespace which it cannot handle, it issues a warning except if this
namespace is in the ignored set.
namespaceURI
- the namespace URI
ignoreNamespaces
public void ignoreNamespaces(Collection namespaceURIs)
Adds a collection of namespaces to the set of ignored namespaces.
If FOP encounters a namespace which it cannot handle, it issues a warning except if this
namespace is in the ignored set.
namespaceURIs
- the namespace URIs
isBase14KerningEnabled
public boolean isBase14KerningEnabled()
- true if kerning on base 14 fonts is enabled
isBreakIndentInheritanceOnReferenceAreaBoundary
public boolean isBreakIndentInheritanceOnReferenceAreaBoundary()
- true if the indent inheritance should be broken when crossing reference area
boundaries (for more info, see the javadoc for the relative member variable)
isNamespaceIgnored
public boolean isNamespaceIgnored(String namespaceURI)
Indicates whether a namespace URI is on the ignored list.
namespaceURI
- the namespace URI
- true if the namespace is ignored by FOP
newFOUserAgent
public FOUserAgent newFOUserAgent()
Returns a new FOUserAgent instance. Use the FOUserAgent to configure special values that
are particular to a rendering run. Don't reuse instances over multiple rendering runs but
instead create a new one each time and reuse the FopFactory.
- the newly created FOUserAgent instance initialized with default values
newFop
public Fop newFop(String outputFormat)
throws FOPException
Returns a new
Fop
instance. FOP will be configured with a default user agent
instance.
MIME types are used to select the output format (ex. "application/pdf" for PDF). You can
use the constants defined in
MimeConstants
.
outputFormat
- the MIME type of the output format to use (ex. "application/pdf").
newFop
public Fop newFop(String outputFormat,
OutputStream stream)
throws FOPException
Returns a new
Fop
instance. FOP will be configured with a default user agent
instance. Use this factory method if your output type requires an output stream.
MIME types are used to select the output format (ex. "application/pdf" for PDF). You can
use the constants defined in
MimeConstants
.
outputFormat
- the MIME type of the output format to use (ex. "application/pdf").stream
- the output stream
newFop
public Fop newFop(String outputFormat,
FOUserAgent userAgent)
throws FOPException
Returns a new
Fop
instance. Use this factory method if you want to configure this
very rendering run, i.e. if you want to set some metadata like the title and author of the
document you want to render. In that case, create a new
FOUserAgent
instance using
newFOUserAgent()
.
MIME types are used to select the output format (ex. "application/pdf" for PDF). You can
use the constants defined in
MimeConstants
.
outputFormat
- the MIME type of the output format to use (ex. "application/pdf").userAgent
- the user agent that will be used to control the rendering run
newFop
public Fop newFop(String outputFormat,
FOUserAgent userAgent,
OutputStream stream)
throws FOPException
Returns a new
Fop
instance. Use this factory method if your output type
requires an output stream and you want to configure this very rendering run,
i.e. if you want to set some metadata like the title and author of the document
you want to render. In that case, create a new
FOUserAgent
instance
using
newFOUserAgent()
.
MIME types are used to select the output format (ex. "application/pdf" for PDF). You can
use the constants defined in
MimeConstants
.
outputFormat
- the MIME type of the output format to use (ex. "application/pdf").userAgent
- the user agent that will be used to control the rendering runstream
- the output stream
newFop
public Fop newFop(FOUserAgent userAgent)
throws FOPException
Returns a new
Fop
instance. Use this factory method if you want to supply your
own
Renderer
or
FOEventHandler
instance instead of the default ones created internally by FOP.
userAgent
- the user agent that will be used to control the rendering run
newInstance
public static FopFactory newInstance()
Returns a new FopFactory instance.
- the requested FopFactory instance.
resolveURI
public Source resolveURI(String href,
String baseUri)
Attempts to resolve the given URI.
Will use the configured resolver and if not successful fall back
to the default resolver.
href
- URI to accessbaseUri
- the base URI to resolve against
- A
javax.xml.transform.Source
object, or null if the URI
cannot be resolved.
setBase14KerningEnabled
public void setBase14KerningEnabled(boolean value)
Controls whether kerning is activated on base 14 fonts.
value
- true if kerning should be activated
setBaseURL
public void setBaseURL(String base)
throws MalformedURLException
Sets the base URL.
setBreakIndentInheritanceOnReferenceAreaBoundary
public void setBreakIndentInheritanceOnReferenceAreaBoundary(boolean value)
Controls whether to enable a feature that breaks indent inheritance when crossing
reference area boundaries.
This flag controls whether FOP will enable special code that breaks property
inheritance for start-indent and end-indent when the evaluation of the inherited
value would cross a reference area. This is described under
http://wiki.apache.org/xmlgraphics-fop/IndentInheritance as is intended to
improve interoperability with commercial FO implementations and to produce
results that are more in line with the expectation of unexperienced FO users.
Note: Enabling this features violates the XSL specification!
value
- true to enable the feature
setFontBaseURL
public void setFontBaseURL(String fontBase)
throws MalformedURLException
Sets the font base URL.
setHyphenBaseURL
public void setHyphenBaseURL(String hyphenBase)
throws MalformedURLException
Sets the hyphen base URL.
hyphenBase
- hythen base URL
setHyphenationTreeResolver
public void setHyphenationTreeResolver(HyphenationTreeResolver hyphResolver)
Sets the HyphenationTreeResolver to be used for resolving user-supplied hyphenation files.
hyphResolver
- the HyphenationTreeResolver instance
setLayoutManagerMakerOverride
public void setLayoutManagerMakerOverride(LayoutManagerMaker lmMaker)
Sets an explicit LayoutManagerMaker instance which overrides the one
defined by the AreaTreeHandler.
lmMaker
- the LayoutManagerMaker instance
setPageHeight
public void setPageHeight(String pageHeight)
Sets the page-height to use as fallback, in case
page-height="auto"
pageHeight
- page-height as a String
setPageWidth
public void setPageWidth(String pageWidth)
Sets the page-width to use as fallback, in case
page-width="auto"
pageWidth
- page-width as a String
setSourceResolution
public void setSourceResolution(float dpi)
Sets the source resolution in dpi. This value is used to interpret the pixel size
of source documents like SVG images and bitmap images without resolution information.
setSourceResolution
public void setSourceResolution(int dpi)
Sets the source resolution in dpi. This value is used to interpret the pixel size
of source documents like SVG images and bitmap images without resolution information.
setStrictUserConfigValidation
public void setStrictUserConfigValidation(boolean strictUserConfigValidation)
Is the user configuration to be validated?
strictUserConfigValidation
- strict user config validation
setStrictValidation
public void setStrictValidation(boolean validateStrictly)
Activates strict XSL content model validation for FOP
Default is false (FOP will continue processing where it can)
validateStrictly
- true to turn on strict validation
setTargetResolution
public void setTargetResolution(float dpi)
Sets the source resolution in dpi. This value is used to interpret the pixel size
of source documents like SVG images and bitmap images without resolution information.
setURIResolver
public void setURIResolver(URIResolver uriResolver)
Sets the URI Resolver. It is used for resolving factory-level URIs like hyphenation
patterns and as backup for URI resolution performed during a rendering run.
uriResolver
- the new URI resolver
setUseCache
public void setUseCache(boolean useCache)
Whether or not to cache results of font triplet detection/auto-config
useCache
- use cache or not
setUserConfig
public void setUserConfig(Configuration userConfig)
throws FOPException
Set the user configuration.
userConfig
- configuration
setUserConfig
public void setUserConfig(File userConfigFile)
throws SAXException,
IOException
Set the user configuration.
userConfigFile
- the configuration file
setUserConfig
public void setUserConfig(String uri)
throws SAXException,
IOException
Set the user configuration from an URI.
uri
- the URI to the configuration file
useCache
public boolean useCache()
Cache results of font triplet detection/auto-config?
- whether this factory is uses the cache
validateStrictly
public boolean validateStrictly()
Returns whether FOP is strictly validating input XSL
- true of strict validation turned on, false otherwise
validateUserConfigStrictly
public boolean validateUserConfigStrictly()
Is the user configuration to be validated?
- if the user configuration should be validated