Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| fop 1.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.fop.apps
Class FopFactory

    java.lang.Object
      org.apache.fop.apps.FopFactory

All Implemented Interfaces:
  org.apache.xmlgraphics.image.loader.ImageContext

    public class FopFactory

extends java.lang.Object
implements org.apache.xmlgraphics.image.loader.ImageContext

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.

Constructor Summary
`protected` | `FopFactory()` Main constructor.

Method Summary
`void` | `addElementMapping(ElementMapping elementMapping)` Add the element mapping with the given class name.
`java.lang.String` | `getBaseURL()` Returns the base URL.
`ColorSpaceCache` | `getColorSpaceCache()` Returns the color space cache for this instance.
`ContentHandlerFactoryRegistry` | `getContentHandlerFactoryRegistry()`
`ElementMappingRegistry` | `getElementMappingRegistry()`
`java.lang.String` | `getFontBaseURL()` Deprecated. use getFontManager().setFontBaseURL(fontBase) instead
`FontCache` | `getFontCache()` Deprecated. use getFontManager().getFontCache() instead
`FontManager` | `getFontManager()` Returns the font manager.
`FOURIResolver` | `getFOURIResolver()` Returns the FO URI Resolver.
`HyphenationTreeResolver` | `getHyphenationTreeResolver()`
`java.lang.String` | `getHyphenBaseURL()`
`java.util.Map` | `getHyphPatNames()`
`java.util.Set<java.lang.String>` | `getIgnoredNamespace()`
`ImageHandlerRegistry` | `getImageHandlerRegistry()`
`org.apache.xmlgraphics.image.loader.ImageManager` | `getImageManager()` Returns the image manager.
`LayoutManagerMaker` | `getLayoutManagerMakerOverride()` Returns the overriding LayoutManagerMaker instance, if any.
`java.lang.String` | `getPageHeight()` Gets the default page-height to use as fallback, in case page-height="auto"
`java.lang.String` | `getPageWidth()` Gets the default page-width to use as fallback, in case page-width="auto"
`RendererFactory` | `getRendererFactory()`
`float` | `getSourcePixelUnitToMillimeter()` Returns the conversion factor from pixel units to millimeters.
`float` | `getSourceResolution()`
`float` | `getTargetPixelUnitToMillimeter()` Returns the conversion factor from pixel units to millimeters.
`float` | `getTargetResolution()`
`javax.xml.transform.URIResolver` | `getURIResolver()` Returns the URI Resolver.
`org.apache.avalon.framework.configuration.Configuration` | `getUserConfig()` Get the user configuration.
`XMLHandlerRegistry` | `getXMLHandlerRegistry()`
`void` | `ignoreNamespace(java.lang.String namespaceURI)` Adds a namespace to the set of ignored namespaces.
`void` | `ignoreNamespaces(java.util.Collection<java.lang.String> namespaceURIs)` Adds a collection of namespaces to the set of ignored namespaces.
`boolean` | `isBase14KerningEnabled()` Deprecated. use getFontManager().isBase14KerningEnabled() instead
`boolean` | `isBreakIndentInheritanceOnReferenceAreaBoundary()`
`boolean` | `isNamespaceIgnored(java.lang.String namespaceURI)` Indicates whether a namespace URI is on the ignored list.
`Fop` | `newFop(FOUserAgent userAgent)` Returns a new `Fop` instance.
`Fop` | `newFop(java.lang.String outputFormat)` Returns a new `Fop` instance.
`Fop` | `newFop(java.lang.String outputFormat, FOUserAgent userAgent)` Returns a new `Fop` instance.
`Fop` | `newFop(java.lang.String outputFormat, FOUserAgent userAgent, java.io.OutputStream stream)` Returns a new `Fop` instance.
`Fop` | `newFop(java.lang.String outputFormat, java.io.OutputStream stream)` Returns a new `Fop` instance.
`FOUserAgent` | `newFOUserAgent()` Returns a new FOUserAgent instance.
`static FopFactory` | `newInstance()` Returns a new FopFactory instance.
`javax.xml.transform.Source` | `resolveURI(java.lang.String href, java.lang.String baseUri)` Attempts to resolve the given URI.
`void` | `setBase14KerningEnabled(boolean value)` Deprecated. use getFontManager().setBase14KerningEnabled(boolean) instead
`void` | `setBaseURL(java.lang.String base)` Sets the base URL.
`void` | `setBreakIndentInheritanceOnReferenceAreaBoundary(boolean value)` Controls whether to enable a feature that breaks indent inheritance when crossing reference area boundaries.
`void` | `setFontBaseURL(java.lang.String fontBase)` Deprecated. use getFontManager().setFontBaseURL(fontBase) instead
`void` | `setHyphenationTreeResolver(HyphenationTreeResolver hyphResolver)` Sets the HyphenationTreeResolver to be used for resolving user-supplied hyphenation files.
`void` | `setHyphenBaseURL(java.lang.String hyphenBase)` Sets the hyphen base URL.
`void` | `setHyphPatNames(java.util.Map hyphPatNames)`
`void` | `setLayoutManagerMakerOverride(LayoutManagerMaker lmMaker)` Sets an explicit LayoutManagerMaker instance which overrides the one defined by the AreaTreeHandler.
`void` | `setPageHeight(java.lang.String pageHeight)` Sets the page-height to use as fallback, in case page-height="auto"
`void` | `setPageWidth(java.lang.String pageWidth)` Sets the page-width to use as fallback, in case page-width="auto"
`void` | `setSourceResolution(float dpi)` Sets the source resolution in dpi.
`void` | `setSourceResolution(int dpi)` Sets the source resolution in dpi.
`void` | `setStrictUserConfigValidation(boolean strictUserConfigValidation)` Is the user configuration to be validated?
`void` | `setStrictValidation(boolean validateStrictly)` Activates strict XSL content model validation for FOP Default is false (FOP will continue processing where it can)
`void` | `setTargetResolution(float dpi)` Sets the source resolution in dpi.
`void` | `setURIResolver(javax.xml.transform.URIResolver uriResolver)` Sets the URI Resolver.
`void` | `setUseCache(boolean useCache)` Deprecated. use getFontManager().setUseCache(boolean) instead
`void` | `setUserConfig(org.apache.avalon.framework.configuration.Configuration userConfig)` Set the user configuration.
`void` | `setUserConfig(java.io.File userConfigFile)` Set the user configuration.
`void` | `setUserConfig(java.lang.String uri)` Set the user configuration from an URI.
`void` | `setUserConfigBaseURI(java.net.URI baseURI)` Set the base URI for the user configuration Useful for programmatic configurations
`boolean` | `useCache()` Deprecated. use getFontManager().useCache() instead
`boolean` | `validateStrictly()` Returns whether FOP is strictly validating input XSL
`boolean` | `validateUserConfigStrictly()` Is the user configuration to be validated?

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FopFactory

    protected FopFactory()

  Main constructor.

Method Detail

### newInstance

    public static FopFactory newInstance()

  Returns a new FopFactory instance.

  Returns:
    the requested FopFactory instance.

### 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.

  Returns:
    the newly created FOUserAgent instance initialized with default values
  Throws:
    `FOPException`

### newFop

    public Fop newFop(java.lang.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`.

  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(java.lang.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`.

  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(java.lang.String outputFormat,
                      java.io.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`.

  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(java.lang.String outputFormat,
                      FOUserAgent userAgent,
                      java.io.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`.

  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
    `stream` - the output stream
  Returns:
    the new Fop instance
  Throws:
    `FOPException` - when the constructor fails

### 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.

  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 RendererFactory getRendererFactory()

  Returns:
    the RendererFactory

### getXMLHandlerRegistry

    public XMLHandlerRegistry getXMLHandlerRegistry()

  Returns:
    the XML handler registry

### getImageHandlerRegistry

    public ImageHandlerRegistry getImageHandlerRegistry()

  Returns:
    the image handler registry

### getElementMappingRegistry

    public ElementMappingRegistry getElementMappingRegistry()

  Returns:
    the element mapping registry

### getContentHandlerFactoryRegistry

    public ContentHandlerFactoryRegistry getContentHandlerFactoryRegistry()

  Returns:
    the content handler factory registry

### getImageManager

    public org.apache.xmlgraphics.image.loader.ImageManager getImageManager()

  Returns the image manager.

  Returns:
    the image manager

### addElementMapping

    public void addElementMapping(ElementMapping elementMapping)

  Add the element mapping with the given class name.

  Parameters:
    `elementMapping` - the class name representing the element mapping.

### setLayoutManagerMakerOverride

    public void setLayoutManagerMakerOverride(LayoutManagerMaker lmMaker)

  Sets an explicit LayoutManagerMaker instance which overrides the one defined by the AreaTreeHandler.

  Parameters:
    `lmMaker` - the LayoutManagerMaker instance

### getLayoutManagerMakerOverride

    public LayoutManagerMaker getLayoutManagerMakerOverride()

  Returns the overriding LayoutManagerMaker instance, if any.

  Returns:
    the overriding LayoutManagerMaker or null

### setBaseURL

    public void setBaseURL(java.lang.String base)
                    throws java.net.MalformedURLException

  Sets the base URL.

  Parameters:
    `base` - the base URL
  Throws:
    `java.net.MalformedURLException` - if there's a problem with a file URL

### getBaseURL

    public java.lang.String getBaseURL()

  Returns the base URL.

  Returns:
    the base URL

### setFontBaseURL

    @Deprecated
    public void setFontBaseURL(java.lang.String fontBase)
                        throws java.net.MalformedURLException

  Deprecated. use getFontManager().setFontBaseURL(fontBase) instead

  Sets the font base URL.

  Parameters:
    `fontBase` - font base URL
  Throws:
    `java.net.MalformedURLException` - if there's a problem with a file URL

### getFontBaseURL

    @Deprecated
    public java.lang.String getFontBaseURL()

  Deprecated. use getFontManager().setFontBaseURL(fontBase) instead

  Returns:
    the font base URL

### getHyphenBaseURL

    public java.lang.String getHyphenBaseURL()

  Returns:
    the hyphen base URL

### setHyphenBaseURL

    public void setHyphenBaseURL(java.lang.String hyphenBase)
                          throws java.net.MalformedURLException

  Sets the hyphen base URL.

  Parameters:
    `hyphenBase` - hythen base URL
  Throws:
    `java.net.MalformedURLException` - if there's a problem with a file URL

### getHyphPatNames

    public java.util.Map getHyphPatNames()

  Returns:
    the hyphPatNames

### setHyphPatNames

    public void setHyphPatNames(java.util.Map hyphPatNames)

  Parameters:
    `hyphPatNames` - the hyphPatNames to set

### setURIResolver

    public void setURIResolver(javax.xml.transform.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.

  Parameters:
    `uriResolver` - the new URI resolver

### getURIResolver

    public javax.xml.transform.URIResolver getURIResolver()

  Returns the URI Resolver.

  Returns:
    the URI Resolver

### getFOURIResolver

    public FOURIResolver getFOURIResolver()

  Returns the FO URI Resolver.

  Returns:
    the FO URI Resolver

### getHyphenationTreeResolver

    public HyphenationTreeResolver getHyphenationTreeResolver()

  Returns:
    the HyphenationTreeResolver for resolving user-supplied hyphenation patterns.

### setHyphenationTreeResolver

    public void setHyphenationTreeResolver(HyphenationTreeResolver hyphResolver)

  Sets the HyphenationTreeResolver to be used for resolving user-supplied hyphenation files.

  Parameters:
    `hyphResolver` - the HyphenationTreeResolver instance

### setStrictValidation

    public void setStrictValidation(boolean validateStrictly)

  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()

  Returns whether FOP is strictly validating input XSL

  Returns:
    true of strict validation turned on, false otherwise

### isBreakIndentInheritanceOnReferenceAreaBoundary

    public boolean isBreakIndentInheritanceOnReferenceAreaBoundary()

  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)

  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

    @Deprecated
    public boolean isBase14KerningEnabled()

  Deprecated. use getFontManager().isBase14KerningEnabled() instead

  Returns:
    true if kerning on base 14 fonts is enabled

### setBase14KerningEnabled

    @Deprecated
    public void setBase14KerningEnabled(boolean value)

  Deprecated. use getFontManager().setBase14KerningEnabled(boolean) instead

  Controls whether kerning is activated on base 14 fonts.

  Parameters:
    `value` - true if kerning should be activated

### getSourceResolution

    public float getSourceResolution()

  Specified by:
    `getSourceResolution` in interface `org.apache.xmlgraphics.image.loader.ImageContext`
  Returns:
    the resolution for resolution-dependant input

### getSourcePixelUnitToMillimeter

    public float getSourcePixelUnitToMillimeter()

  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)

  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()

  Returns:
    the resolution for resolution-dependant output

### getTargetPixelUnitToMillimeter

    public float getTargetPixelUnitToMillimeter()

  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)

  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)

  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 java.lang.String getPageHeight()

  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(java.lang.String pageHeight)

  Sets the page-height to use as fallback, in case page-height="auto"

  Parameters:
    `pageHeight` - page-height as a String

### getPageWidth

    public java.lang.String getPageWidth()

  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(java.lang.String pageWidth)

  Sets the page-width to use as fallback, in case page-width="auto"

  Parameters:
    `pageWidth` - page-width as a String

### ignoreNamespace

    public void ignoreNamespace(java.lang.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.

  Parameters:
    `namespaceURI` - the namespace URI

### ignoreNamespaces

    public void ignoreNamespaces(java.util.Collection<java.lang.String> 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.

  Parameters:
    `namespaceURIs` - the namespace URIs

### isNamespaceIgnored

    public boolean isNamespaceIgnored(java.lang.String namespaceURI)

  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 java.util.Set<java.lang.String> getIgnoredNamespace()

  Returns:
    the set of namespaces that are ignored by FOP

### setUserConfig

    public void setUserConfig(java.io.File userConfigFile)
                       throws org.xml.sax.SAXException,
                              java.io.IOException

  Set the user configuration.

  Parameters:
    `userConfigFile` - the configuration file
  Throws:
    `java.io.IOException` - if an I/O error occurs
    `org.xml.sax.SAXException` - if a parsing error occurs

### setUserConfig

    public void setUserConfig(java.lang.String uri)
                       throws org.xml.sax.SAXException,
                              java.io.IOException

  Set the user configuration from an URI.

  Parameters:
    `uri` - the URI to the configuration file
  Throws:
    `java.io.IOException` - if an I/O error occurs
    `org.xml.sax.SAXException` - if a parsing error occurs

### setUserConfig

    public void setUserConfig(org.apache.avalon.framework.configuration.Configuration userConfig)
                       throws FOPException

  Set the user configuration.

  Parameters:
    `userConfig` - configuration
  Throws:
    `FOPException` - if a configuration problem occurs

### setUserConfigBaseURI

    public void setUserConfigBaseURI(java.net.URI baseURI)

  Set the base URI for the user configuration Useful for programmatic configurations

  Parameters:
    `baseURI` - the base URI

### getUserConfig

    public org.apache.avalon.framework.configuration.Configuration getUserConfig()

  Get the user configuration.

  Returns:
    the user configuration

### setStrictUserConfigValidation

    public void setStrictUserConfigValidation(boolean strictUserConfigValidation)

  Is the user configuration to be validated?

  Parameters:
    `strictUserConfigValidation` - strict user config validation

### validateUserConfigStrictly

    public boolean validateUserConfigStrictly()

  Is the user configuration to be validated?

  Returns:
    if the user configuration should be validated

### setUseCache

    @Deprecated
    public void setUseCache(boolean useCache)

  Deprecated. use getFontManager().setUseCache(boolean) instead

  Whether or not to cache results of font triplet detection/auto-config

  Parameters:
    `useCache` - use cache or not

### useCache

    @Deprecated
    public boolean useCache()

  Deprecated. use getFontManager().useCache() instead

  Cache results of font triplet detection/auto-config?

  Returns:
    whether this factory is uses the cache

### getFontCache

    @Deprecated
    public FontCache getFontCache()

  Deprecated. use getFontManager().getFontCache() instead

  Returns the font cache instance used by this factory.

  Returns:
    the font cache

### getFontManager

    public FontManager getFontManager()

  Returns the font manager.

  Returns:
    the font manager

### resolveURI

    public javax.xml.transform.Source resolveURI(java.lang.String href,
                                                 java.lang.String baseUri)

  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 access
    `baseUri` - the base URI to resolve against
  Returns:
    A `Source` object, or null if the URI cannot be resolved.
  See Also:
    `FOURIResolver`

### getColorSpaceCache

    public ColorSpaceCache getColorSpaceCache()

  Returns the color space cache for this instance.

  Note: this method should not be considered as part of FOP's external API.

  Returns:
    the color space cache

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| fop 1.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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