Class AFPSVGHandler

java.lang.Object
org.apache.fop.render.AbstractGenericSVGHandler
org.apache.fop.render.afp.AFPSVGHandler
All Implemented Interfaces:
RendererContextConstants, XMLHandler

public class AFPSVGHandler extends AbstractGenericSVGHandler
AFP XML handler for SVG. Uses Apache Batik for SVG processing. This handler handles XML for foreign objects and delegates to AFPGraphics2DAdapter.
See Also:
  • Constructor Details

    • AFPSVGHandler

      public AFPSVGHandler()
  • Method Details

    • handleXML

      public void handleXML(RendererContext context, Document doc, String ns) throws Exception

      Handle an external xml document inside a Foreign Object Area.

      This may throw an exception if for some reason it cannot be handled. The caller is expected to deal with this exception.

      The implementation may convert the XML document internally to another XML dialect (SVG, for example) and call renderXML() on the AbstractRenderer again (which can be retrieved through the RendererContext).

      Specified by:
      handleXML in interface XMLHandler
      Overrides:
      handleXML in class AbstractGenericSVGHandler
      Parameters:
      context - The RendererContext (contains the user agent)
      doc - A DOM containing the foreign object to be processed
      ns - The Namespace of the foreign object
      Throws:
      Exception - If an error occurs during processing.
    • renderSVGDocument

      protected void renderSVGDocument(RendererContext rendererContext, Document doc) throws IOException
      Render the SVG document.
      Overrides:
      renderSVGDocument in class AbstractGenericSVGHandler
      Parameters:
      rendererContext - the renderer context
      doc - the SVG document
      Throws:
      IOException - In case of an I/O error while painting the image
    • createBridgeContext

      public static org.apache.batik.bridge.BridgeContext createBridgeContext(FOUserAgent userAgent, AFPGraphics2D g2d)
      Parameters:
      userAgent - a user agent instance
      g2d - a graphics context
      Returns:
      a bridge context
    • supportsRenderer

      public boolean supportsRenderer(Renderer renderer)
      Checks if this XMLHandler supports handling an XML namespace for a particular renderer.
      Parameters:
      renderer - the renderer for which to check.
      Returns:
      true if this XML handler supports a particular renderer
    • updateRendererContext

      protected void updateRendererContext(RendererContext context)
      Override this method to update the renderer context if it needs special settings for certain conditions.
      Overrides:
      updateRendererContext in class AbstractGenericSVGHandler
      Parameters:
      context - the renderer context