Class AbstractFOPTranscoder

  • All Implemented Interfaces:
    org.apache.avalon.framework.configuration.Configurable, org.apache.batik.transcoder.Transcoder
    Direct Known Subclasses:
    AbstractPSTranscoder, PDFTranscoder

    public abstract class AbstractFOPTranscoder
    extends org.apache.batik.transcoder.SVGAbstractTranscoder
    implements org.apache.avalon.framework.configuration.Configurable
    This is the common base class of all of FOP's transcoders.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected class  AbstractFOPTranscoder.FOPErrorHandler
      This is the default transcoder error handler for FOP.
      protected class  AbstractFOPTranscoder.FOPTranscoderUserAgent
      A user agent implementation for FOP's Transcoders.
      • Nested classes/interfaces inherited from class org.apache.batik.transcoder.SVGAbstractTranscoder

        org.apache.batik.transcoder.SVGAbstractTranscoder.SVGAbstractTranscoderUserAgent
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static org.apache.batik.transcoder.TranscodingHints.Key KEY_AUTO_FONTS
      The key is used to specify whether the available fonts should be automatically detected.
      static org.apache.batik.transcoder.TranscodingHints.Key KEY_DEVICE_RESOLUTION
      The key is used to specify the resolution for on-the-fly images generated due to complex effects like gradients and filters.
      static org.apache.batik.transcoder.TranscodingHints.Key KEY_STROKE_TEXT
      The key to specify whether to stroke text instead of using text operations.
      static java.lang.Boolean VALUE_FORMAT_OFF
      The value to turn off text stroking.
      static java.lang.Boolean VALUE_FORMAT_ON
      The value to turn on text stroking.
      • Fields inherited from class org.apache.batik.transcoder.SVGAbstractTranscoder

        builder, ctx, curAOI, curTxf, DEFAULT_ALLOWED_SCRIPT_TYPES, DEFAULT_DEFAULT_FONT_FAMILY, height, KEY_ALLOW_EXTERNAL_RESOURCES, KEY_ALLOWED_SCRIPT_TYPES, KEY_ALTERNATE_STYLESHEET, KEY_AOI, KEY_CONSTRAIN_SCRIPT_ORIGIN, KEY_DEFAULT_FONT_FAMILY, KEY_EXECUTE_ONLOAD, KEY_HEIGHT, KEY_LANGUAGE, KEY_MAX_HEIGHT, KEY_MAX_WIDTH, KEY_MEDIA, KEY_PIXEL_TO_MM, KEY_PIXEL_UNIT_TO_MILLIMETER, KEY_SNAPSHOT_TIME, KEY_USER_STYLESHEET_URI, KEY_WIDTH, root, userAgent, width
      • Fields inherited from class org.apache.batik.transcoder.XMLAbstractTranscoder

        KEY_DOCUMENT_ELEMENT, KEY_DOCUMENT_ELEMENT_NAMESPACE_URI, KEY_DOM_IMPLEMENTATION, KEY_XML_PARSER_CLASSNAME, KEY_XML_PARSER_VALIDATING
      • Fields inherited from class org.apache.batik.transcoder.TranscoderSupport

        handler, hints
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractFOPTranscoder()
      Constructs a new FOP-style transcoder.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void configure​(org.apache.avalon.framework.configuration.Configuration cfg)  
      protected org.apache.batik.dom.util.DocumentFactory createDocumentFactory​(org.w3c.dom.DOMImplementation domImpl, java.lang.String parserClassname)
      Creates a DocumentFactory that is used to create an SVG DOM tree.
      protected AbstractFOPTranscoder.FOPTranscoderUserAgent createUserAgent()
      Creates and returns the default user agent for this transcoder.
      protected boolean getAutoFontsDefault()
      Returns the default value for the KEY_AUTO_FONTS value.
      protected float getDeviceResolution()
      Returns the device resolution that has been set up.
      protected org.apache.avalon.framework.configuration.Configuration getEffectiveConfiguration()
      Returns the effective configuration for the transcoder.
      protected org.apache.xmlgraphics.image.loader.ImageManager getImageManager()
      Returns the ImageManager to be used by the transcoder.
      protected org.apache.xmlgraphics.image.loader.ImageSessionContext getImageSessionContext()
      Returns the ImageSessionContext to be used by the transcoder.
      protected org.apache.commons.logging.Log getLogger()
      Returns the logger associated with this transcoder.
      protected boolean isTextStroked()
      Indicates whether text should be stroked rather than painted using text operators.
      void setEntityResolver​(org.xml.sax.EntityResolver resolver)
      Sets the EntityResolver that should be used when building SVG documents.
      void setLogger​(org.apache.commons.logging.Log logger)
      Sets the logger.
      protected void setupImageInfrastructure​(java.lang.String baseURI)
      Sets up the image infrastructure (the image loading framework).
      • Methods inherited from class org.apache.batik.transcoder.SVGAbstractTranscoder

        createBridgeContext, createBridgeContext, createBridgeContext, getCanvasGraphicsNode, setImageSize, transcode, transcode
      • Methods inherited from class org.apache.batik.transcoder.TranscoderSupport

        addTranscodingHint, getErrorHandler, getTranscodingHints, removeTranscodingHint, setErrorHandler, setTranscodingHints, setTranscodingHints
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.batik.transcoder.Transcoder

        addTranscodingHint, getErrorHandler, getTranscodingHints, removeTranscodingHint, setErrorHandler, setTranscodingHints, setTranscodingHints
    • Field Detail

      • KEY_DEVICE_RESOLUTION

        public static final org.apache.batik.transcoder.TranscodingHints.Key KEY_DEVICE_RESOLUTION
        The key is used to specify the resolution for on-the-fly images generated due to complex effects like gradients and filters.
      • KEY_STROKE_TEXT

        public static final org.apache.batik.transcoder.TranscodingHints.Key KEY_STROKE_TEXT
        The key to specify whether to stroke text instead of using text operations.
      • KEY_AUTO_FONTS

        public static final org.apache.batik.transcoder.TranscodingHints.Key KEY_AUTO_FONTS
        The key is used to specify whether the available fonts should be automatically detected. The alternative is to configure the transcoder manually using a configuration file.
      • VALUE_FORMAT_ON

        public static final java.lang.Boolean VALUE_FORMAT_ON
        The value to turn on text stroking.
      • VALUE_FORMAT_OFF

        public static final java.lang.Boolean VALUE_FORMAT_OFF
        The value to turn off text stroking.
    • Constructor Detail

      • AbstractFOPTranscoder

        public AbstractFOPTranscoder()
        Constructs a new FOP-style transcoder.
    • Method Detail

      • createUserAgent

        protected AbstractFOPTranscoder.FOPTranscoderUserAgent createUserAgent()
        Creates and returns the default user agent for this transcoder. Override this method if you need non-default behaviour.
        Overrides:
        createUserAgent in class org.apache.batik.transcoder.SVGAbstractTranscoder
        Returns:
        UserAgent the newly created user agent
      • setLogger

        public void setLogger​(org.apache.commons.logging.Log logger)
        Sets the logger.
        Parameters:
        logger - the logger
      • setEntityResolver

        public void setEntityResolver​(org.xml.sax.EntityResolver resolver)
        Sets the EntityResolver that should be used when building SVG documents.
        Parameters:
        resolver - the resolver
      • configure

        public void configure​(org.apache.avalon.framework.configuration.Configuration cfg)
                       throws org.apache.avalon.framework.configuration.ConfigurationException
        Specified by:
        configure in interface org.apache.avalon.framework.configuration.Configurable
        Parameters:
        cfg - the configuration
        Throws:
        org.apache.avalon.framework.configuration.ConfigurationException - if not caught
      • getAutoFontsDefault

        protected boolean getAutoFontsDefault()
        Returns the default value for the KEY_AUTO_FONTS value.
        Returns:
        the default value
      • getEffectiveConfiguration

        protected org.apache.avalon.framework.configuration.Configuration getEffectiveConfiguration()
        Returns the effective configuration for the transcoder.
        Returns:
        the effective configuration
      • getLogger

        protected final org.apache.commons.logging.Log getLogger()
        Returns the logger associated with this transcoder. It returns a SimpleLog if no logger has been explicitly set.
        Returns:
        Logger the logger for the transcoder.
      • createDocumentFactory

        protected org.apache.batik.dom.util.DocumentFactory createDocumentFactory​(org.w3c.dom.DOMImplementation domImpl,
                                                                                  java.lang.String parserClassname)
        Creates a DocumentFactory that is used to create an SVG DOM tree. The specified DOM Implementation is ignored and the Batik SVG DOM Implementation is automatically used.
        Overrides:
        createDocumentFactory in class org.apache.batik.transcoder.SVGAbstractTranscoder
        Parameters:
        domImpl - the DOM Implementation (not used)
        parserClassname - the XML parser classname
        Returns:
        the document factory
      • isTextStroked

        protected boolean isTextStroked()
        Indicates whether text should be stroked rather than painted using text operators. Stroking text (also referred to as "painting as shapes") can used in situations where the quality of text output is not satisfying. The downside of the work-around: The generated file will likely become bigger and you will lose copy/paste functionality for certain output formats such as PDF.
        Returns:
        true if text should be stroked rather than painted using text operators
      • getDeviceResolution

        protected float getDeviceResolution()
        Returns the device resolution that has been set up.
        Returns:
        the device resolution (in dpi)
      • getImageManager

        protected org.apache.xmlgraphics.image.loader.ImageManager getImageManager()
        Returns the ImageManager to be used by the transcoder.
        Returns:
        the image manager
      • getImageSessionContext

        protected org.apache.xmlgraphics.image.loader.ImageSessionContext getImageSessionContext()
        Returns the ImageSessionContext to be used by the transcoder.
        Returns:
        the image session context
      • setupImageInfrastructure

        protected void setupImageInfrastructure​(java.lang.String baseURI)
        Sets up the image infrastructure (the image loading framework).
        Parameters:
        baseURI - the base URI of the current document