Class FopFactory
- java.lang.Object
-
- org.apache.fop.apps.FopFactory
-
- All Implemented Interfaces:
org.apache.xmlgraphics.image.loader.ImageContext
@Deprecated(since="2021-03-01") public class FopFactory extends Object implements org.apache.xmlgraphics.image.loader.ImageContext
Deprecated.Avoid using this package provided OOTB and migrate code a newer version which you can deploy as part of your project.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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addElementMapping(org.apache.fop.fo.ElementMapping elementMapping)
Deprecated.Add the element mapping with the given class name.String
getBaseURL()
Deprecated.Returns the base URL.ColorSpace
getColorSpace(String baseUri, String iccProfileSrc)
Deprecated.Create (if needed) and return an ICC ColorSpace instance.org.apache.fop.util.ContentHandlerFactoryRegistry
getContentHandlerFactoryRegistry()
Deprecated.org.apache.fop.fo.ElementMappingRegistry
getElementMappingRegistry()
Deprecated.String
getFontBaseURL()
Deprecated.use getFontManager().setFontBaseURL(fontBase) insteadorg.apache.fop.fonts.FontCache
getFontCache()
Deprecated.use getFontManager().getFontCache() insteadorg.apache.fop.fonts.FontManager
getFontManager()
Deprecated.Returns the font manager.FOURIResolver
getFOURIResolver()
Deprecated.Returns the FO URI Resolver.org.apache.fop.hyphenation.HyphenationTreeResolver
getHyphenationTreeResolver()
Deprecated.String
getHyphenBaseURL()
Deprecated.Set
getIgnoredNamespace()
Deprecated.org.apache.fop.render.ImageHandlerRegistry
getImageHandlerRegistry()
Deprecated.org.apache.xmlgraphics.image.loader.ImageManager
getImageManager()
Deprecated.Returns the image manager.org.apache.fop.layoutmgr.LayoutManagerMaker
getLayoutManagerMakerOverride()
Deprecated.Returns the overriding LayoutManagerMaker instance, if any.String
getPageHeight()
Deprecated.Gets the default page-height to use as fallback, in case page-height="auto"String
getPageWidth()
Deprecated.Gets the default page-width to use as fallback, in case page-width="auto"org.apache.fop.render.RendererFactory
getRendererFactory()
Deprecated.float
getSourcePixelUnitToMillimeter()
Deprecated.Returns the conversion factor from pixel units to millimeters.float
getSourceResolution()
Deprecated.float
getTargetPixelUnitToMillimeter()
Deprecated.Returns the conversion factor from pixel units to millimeters.float
getTargetResolution()
Deprecated.URIResolver
getURIResolver()
Deprecated.Returns the URI Resolver.org.apache.avalon.framework.configuration.Configuration
getUserConfig()
Deprecated.Get the user configuration.org.apache.fop.render.XMLHandlerRegistry
getXMLHandlerRegistry()
Deprecated.void
ignoreNamespace(String namespaceURI)
Deprecated.Adds a namespace to the set of ignored namespaces.void
ignoreNamespaces(Collection namespaceURIs)
Deprecated.Adds a collection of namespaces to the set of ignored namespaces.boolean
isBase14KerningEnabled()
Deprecated.use getFontManager().isBase14KerningEnabled() insteadboolean
isBreakIndentInheritanceOnReferenceAreaBoundary()
Deprecated.boolean
isNamespaceIgnored(String namespaceURI)
Deprecated.Indicates whether a namespace URI is on the ignored list.Fop
newFop(String outputFormat)
Deprecated.Returns a newFop
instance.Fop
newFop(String outputFormat, OutputStream stream)
Deprecated.Returns a newFop
instance.Fop
newFop(String outputFormat, FOUserAgent userAgent)
Deprecated.Returns a newFop
instance.Fop
newFop(String outputFormat, FOUserAgent userAgent, OutputStream stream)
Deprecated.Returns a newFop
instance.Fop
newFop(FOUserAgent userAgent)
Deprecated.Returns a newFop
instance.FOUserAgent
newFOUserAgent()
Deprecated.Returns a new FOUserAgent instance.static FopFactory
newInstance()
Deprecated.Returns a new FopFactory instance.Source
resolveURI(String href, String baseUri)
Deprecated.Attempts to resolve the given URI.void
setBase14KerningEnabled(boolean value)
Deprecated.use getFontManager().setBase14KerningEnabled(boolean) insteadvoid
setBaseURL(String base)
Deprecated.Sets the base URL.void
setBreakIndentInheritanceOnReferenceAreaBoundary(boolean value)
Deprecated.Controls whether to enable a feature that breaks indent inheritance when crossing reference area boundaries.void
setFontBaseURL(String fontBase)
Deprecated.use getFontManager().setFontBaseURL(fontBase) insteadvoid
setHyphenationTreeResolver(org.apache.fop.hyphenation.HyphenationTreeResolver hyphResolver)
Deprecated.Sets the HyphenationTreeResolver to be used for resolving user-supplied hyphenation files.void
setHyphenBaseURL(String hyphenBase)
Deprecated.Sets the hyphen base URL.void
setLayoutManagerMakerOverride(org.apache.fop.layoutmgr.LayoutManagerMaker lmMaker)
Deprecated.Sets an explicit LayoutManagerMaker instance which overrides the one defined by the AreaTreeHandler.void
setPageHeight(String pageHeight)
Deprecated.Sets the page-height to use as fallback, in case page-height="auto"void
setPageWidth(String pageWidth)
Deprecated.Sets the page-width to use as fallback, in case page-width="auto"void
setSourceResolution(float dpi)
Deprecated.Sets the source resolution in dpi.void
setSourceResolution(int dpi)
Deprecated.Sets the source resolution in dpi.void
setStrictUserConfigValidation(boolean strictUserConfigValidation)
Deprecated.Is the user configuration to be validated?void
setStrictValidation(boolean validateStrictly)
Deprecated.Activates strict XSL content model validation for FOP Default is false (FOP will continue processing where it can)void
setTargetResolution(float dpi)
Deprecated.Sets the source resolution in dpi.void
setURIResolver(URIResolver uriResolver)
Deprecated.Sets the URI Resolver.void
setUseCache(boolean useCache)
Deprecated.use getFontManager().setUseCache(boolean) insteadvoid
setUserConfig(File userConfigFile)
Deprecated.Set the user configuration.void
setUserConfig(String uri)
Deprecated.Set the user configuration from an URI.void
setUserConfig(org.apache.avalon.framework.configuration.Configuration userConfig)
Deprecated.Set the user configuration.boolean
useCache()
Deprecated.use getFontManager().useCache() insteadboolean
validateStrictly()
Deprecated.Returns whether FOP is strictly validating input XSLboolean
validateUserConfigStrictly()
Deprecated.Is the user configuration to be validated?
-
-
-
Method Detail
-
newInstance
public static FopFactory newInstance()
Deprecated.Returns a new FopFactory instance.- Returns:
- the requested FopFactory instance.
-
newFOUserAgent
public FOUserAgent newFOUserAgent()
Deprecated.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.- Returns:
- the newly created FOUserAgent instance initialized with default values
- Throws:
FOPException
-
newFop
public Fop newFop(String outputFormat) throws FOPException
Deprecated.Returns a newFop
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
.- Parameters:
outputFormat
- the MIME type of the output format to use (ex. "application/pdf").- Returns:
- the new Fop instance
- Throws:
FOPException
- when the constructor fails
-
newFop
public Fop newFop(String outputFormat, FOUserAgent userAgent) throws FOPException
Deprecated.Returns a newFop
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 newFOUserAgent
instance usingnewFOUserAgent()
.MIME types are used to select the output format (ex. "application/pdf" for PDF). You can use the constants defined in
MimeConstants
.- Parameters:
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- Returns:
- the new Fop instance
- Throws:
FOPException
- when the constructor fails
-
newFop
public Fop newFop(String outputFormat, OutputStream stream) throws FOPException
Deprecated.Returns a newFop
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
.- Parameters:
outputFormat
- the MIME type of the output format to use (ex. "application/pdf").stream
- the output stream- Returns:
- the new Fop instance
- Throws:
FOPException
- when the constructor fails
-
newFop
public Fop newFop(String outputFormat, FOUserAgent userAgent, OutputStream stream) throws FOPException
Deprecated.Returns a newFop
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 newFOUserAgent
instance usingnewFOUserAgent()
.MIME types are used to select the output format (ex. "application/pdf" for PDF). You can use the constants defined in
MimeConstants
.- Parameters:
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- Returns:
- the new Fop instance
- Throws:
FOPException
- when the constructor fails
-
newFop
public Fop newFop(FOUserAgent userAgent) throws FOPException
Deprecated.Returns a newFop
instance. Use this factory method if you want to supply your ownRenderer
orFOEventHandler
instance instead of the default ones created internally by FOP.- Parameters:
userAgent
- the user agent that will be used to control the rendering run- Returns:
- the new Fop instance
- Throws:
FOPException
- when the constructor fails
-
getRendererFactory
public org.apache.fop.render.RendererFactory getRendererFactory()
Deprecated.- Returns:
- the RendererFactory
-
getXMLHandlerRegistry
public org.apache.fop.render.XMLHandlerRegistry getXMLHandlerRegistry()
Deprecated.- Returns:
- the XML handler registry
-
getImageHandlerRegistry
public org.apache.fop.render.ImageHandlerRegistry getImageHandlerRegistry()
Deprecated.- Returns:
- the image handler registry
-
getElementMappingRegistry
public org.apache.fop.fo.ElementMappingRegistry getElementMappingRegistry()
Deprecated.- Returns:
- the element mapping registry
-
getContentHandlerFactoryRegistry
public org.apache.fop.util.ContentHandlerFactoryRegistry getContentHandlerFactoryRegistry()
Deprecated.- Returns:
- the content handler factory registry
-
getImageManager
public org.apache.xmlgraphics.image.loader.ImageManager getImageManager()
Deprecated.Returns the image manager.- Returns:
- the image manager
-
addElementMapping
public void addElementMapping(org.apache.fop.fo.ElementMapping elementMapping)
Deprecated.Add the element mapping with the given class name.- Parameters:
elementMapping
- the class name representing the element mapping.
-
setLayoutManagerMakerOverride
public void setLayoutManagerMakerOverride(org.apache.fop.layoutmgr.LayoutManagerMaker lmMaker)
Deprecated.Sets an explicit LayoutManagerMaker instance which overrides the one defined by the AreaTreeHandler.- Parameters:
lmMaker
- the LayoutManagerMaker instance
-
getLayoutManagerMakerOverride
public org.apache.fop.layoutmgr.LayoutManagerMaker getLayoutManagerMakerOverride()
Deprecated.Returns the overriding LayoutManagerMaker instance, if any.- Returns:
- the overriding LayoutManagerMaker or null
-
setBaseURL
public void setBaseURL(String base) throws MalformedURLException
Deprecated.Sets the base URL.- Parameters:
base
- the base URL- Throws:
MalformedURLException
- if there's a problem with a file URL
-
getBaseURL
public String getBaseURL()
Deprecated.Returns the base URL.- Returns:
- the base URL
-
setFontBaseURL
public void setFontBaseURL(String fontBase) throws MalformedURLException
Deprecated.use getFontManager().setFontBaseURL(fontBase) insteadSets the font base URL.- Parameters:
fontBase
- font base URL- Throws:
MalformedURLException
- if there's a problem with a file URL
-
getFontBaseURL
public String getFontBaseURL()
Deprecated.use getFontManager().setFontBaseURL(fontBase) instead- Returns:
- the font base URL
-
getHyphenBaseURL
public String getHyphenBaseURL()
Deprecated.- Returns:
- the hyphen base URL
-
setHyphenBaseURL
public void setHyphenBaseURL(String hyphenBase) throws MalformedURLException
Deprecated.Sets the hyphen base URL.- Parameters:
hyphenBase
- hythen base URL- Throws:
MalformedURLException
- if there's a problem with a file URL
-
setURIResolver
public void setURIResolver(URIResolver uriResolver)
Deprecated.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.- Parameters:
uriResolver
- the new URI resolver
-
getURIResolver
public URIResolver getURIResolver()
Deprecated.Returns the URI Resolver.- Returns:
- the URI Resolver
-
getFOURIResolver
public FOURIResolver getFOURIResolver()
Deprecated.Returns the FO URI Resolver.- Returns:
- the FO URI Resolver
-
getHyphenationTreeResolver
public org.apache.fop.hyphenation.HyphenationTreeResolver getHyphenationTreeResolver()
Deprecated.- Returns:
- the HyphenationTreeResolver for resolving user-supplied hyphenation patterns.
-
setHyphenationTreeResolver
public void setHyphenationTreeResolver(org.apache.fop.hyphenation.HyphenationTreeResolver hyphResolver)
Deprecated.Sets the HyphenationTreeResolver to be used for resolving user-supplied hyphenation files.- Parameters:
hyphResolver
- the HyphenationTreeResolver instance
-
setStrictValidation
public void setStrictValidation(boolean validateStrictly)
Deprecated.Activates strict XSL content model validation for FOP Default is false (FOP will continue processing where it can)- Parameters:
validateStrictly
- true to turn on strict validation
-
validateStrictly
public boolean validateStrictly()
Deprecated.Returns whether FOP is strictly validating input XSL- Returns:
- true of strict validation turned on, false otherwise
-
isBreakIndentInheritanceOnReferenceAreaBoundary
public boolean isBreakIndentInheritanceOnReferenceAreaBoundary()
Deprecated.- Returns:
- true if the indent inheritance should be broken when crossing reference area boundaries (for more info, see the javadoc for the relative member variable)
-
setBreakIndentInheritanceOnReferenceAreaBoundary
public void setBreakIndentInheritanceOnReferenceAreaBoundary(boolean value)
Deprecated.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!
- Parameters:
value
- true to enable the feature
-
isBase14KerningEnabled
public boolean isBase14KerningEnabled()
Deprecated.use getFontManager().isBase14KerningEnabled() instead- Returns:
- true if kerning on base 14 fonts is enabled
-
setBase14KerningEnabled
public void setBase14KerningEnabled(boolean value)
Deprecated.use getFontManager().setBase14KerningEnabled(boolean) insteadControls whether kerning is activated on base 14 fonts.- Parameters:
value
- true if kerning should be activated
-
getSourceResolution
public float getSourceResolution()
Deprecated.- Specified by:
getSourceResolution
in interfaceorg.apache.xmlgraphics.image.loader.ImageContext
- Returns:
- the resolution for resolution-dependant input
-
getSourcePixelUnitToMillimeter
public float getSourcePixelUnitToMillimeter()
Deprecated.Returns the conversion factor from pixel units to millimeters. This depends on the desired source resolution.- Returns:
- float conversion factor
- See Also:
getSourceResolution()
-
setSourceResolution
public void setSourceResolution(float dpi)
Deprecated.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.- Parameters:
dpi
- resolution in dpi
-
getTargetResolution
public float getTargetResolution()
Deprecated.- Returns:
- the resolution for resolution-dependant output
-
getTargetPixelUnitToMillimeter
public float getTargetPixelUnitToMillimeter()
Deprecated.Returns the conversion factor from pixel units to millimeters. This depends on the desired target resolution.- Returns:
- float conversion factor
- See Also:
getTargetResolution()
-
setTargetResolution
public void setTargetResolution(float dpi)
Deprecated.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.- Parameters:
dpi
- resolution in dpi
-
setSourceResolution
public void setSourceResolution(int dpi)
Deprecated.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.- Parameters:
dpi
- resolution in dpi
-
getPageHeight
public String getPageHeight()
Deprecated.Gets the default page-height to use as fallback, in case page-height="auto"- Returns:
- the page-height, as a String
-
setPageHeight
public void setPageHeight(String pageHeight)
Deprecated.Sets the page-height to use as fallback, in case page-height="auto"- Parameters:
pageHeight
- page-height as a String
-
getPageWidth
public String getPageWidth()
Deprecated.Gets the default page-width to use as fallback, in case page-width="auto"- Returns:
- the page-width, as a String
-
setPageWidth
public void setPageWidth(String pageWidth)
Deprecated.Sets the page-width to use as fallback, in case page-width="auto"- Parameters:
pageWidth
- page-width as a String
-
ignoreNamespace
public void ignoreNamespace(String namespaceURI)
Deprecated.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.- Parameters:
namespaceURI
- the namespace URI
-
ignoreNamespaces
public void ignoreNamespaces(Collection namespaceURIs)
Deprecated.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.- Parameters:
namespaceURIs
- the namespace URIs
-
isNamespaceIgnored
public boolean isNamespaceIgnored(String namespaceURI)
Deprecated.Indicates whether a namespace URI is on the ignored list.- Parameters:
namespaceURI
- the namespace URI- Returns:
- true if the namespace is ignored by FOP
-
getIgnoredNamespace
public Set getIgnoredNamespace()
Deprecated.- Returns:
- the set of namespaces that are ignored by FOP
-
setUserConfig
public void setUserConfig(File userConfigFile) throws SAXException, IOException
Deprecated.Set the user configuration.- Parameters:
userConfigFile
- the configuration file- Throws:
IOException
- if an I/O error occursSAXException
- if a parsing error occurs
-
setUserConfig
public void setUserConfig(String uri) throws SAXException, IOException
Deprecated.Set the user configuration from an URI.- Parameters:
uri
- the URI to the configuration file- Throws:
IOException
- if an I/O error occursSAXException
- if a parsing error occurs
-
setUserConfig
public void setUserConfig(org.apache.avalon.framework.configuration.Configuration userConfig) throws FOPException
Deprecated.Set the user configuration.- Parameters:
userConfig
- configuration- Throws:
FOPException
- if a configuration problem occurs
-
getUserConfig
public org.apache.avalon.framework.configuration.Configuration getUserConfig()
Deprecated.Get the user configuration.- Returns:
- the user configuration
-
setStrictUserConfigValidation
public void setStrictUserConfigValidation(boolean strictUserConfigValidation)
Deprecated.Is the user configuration to be validated?- Parameters:
strictUserConfigValidation
- strict user config validation
-
validateUserConfigStrictly
public boolean validateUserConfigStrictly()
Deprecated.Is the user configuration to be validated?- Returns:
- if the user configuration should be validated
-
setUseCache
public void setUseCache(boolean useCache)
Deprecated.use getFontManager().setUseCache(boolean) insteadWhether or not to cache results of font triplet detection/auto-config- Parameters:
useCache
- use cache or not
-
useCache
public boolean useCache()
Deprecated.use getFontManager().useCache() insteadCache results of font triplet detection/auto-config?- Returns:
- whether this factory is uses the cache
-
getFontCache
public org.apache.fop.fonts.FontCache getFontCache()
Deprecated.use getFontManager().getFontCache() insteadReturns the font cache instance used by this factory.- Returns:
- the font cache
-
getFontManager
public org.apache.fop.fonts.FontManager getFontManager()
Deprecated.Returns the font manager.- Returns:
- the font manager
-
resolveURI
public Source resolveURI(String href, String baseUri)
Deprecated.Attempts to resolve the given URI. Will use the configured resolver and if not successful fall back to the default resolver.- Parameters:
href
- URI to accessbaseUri
- the base URI to resolve against- Returns:
- A
Source
object, or null if the URI cannot be resolved. - See Also:
FOURIResolver
-
getColorSpace
public ColorSpace getColorSpace(String baseUri, String iccProfileSrc)
Deprecated.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.- Parameters:
baseUri
- a base URI to resolve relative URIsiccProfileSrc
- ICC Profile source to return a ColorSpace for- Returns:
- ICC ColorSpace object or null if ColorSpace could not be created
-
-