org.apache.fop.render.afp

## 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:
    `AFPGraphics2DAdapter`

- - ### Field Summary

    - ### Fields inherited from interface org.apache.fop.render.XMLHandler

      `HANDLE_ALL`

    - ### Fields inherited from interface org.apache.fop.render.RendererContextConstants

      `FOREIGN_ATTRIBUTES, HANDLER_CONFIGURATION, HEIGHT, OUTPUT_STREAM, PAGE_VIEWPORT, WIDTH, XPOS, YPOS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AFPSVGHandler()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static org.apache.batik.bridge.BridgeContext` | `createBridgeContext(FOUserAgent userAgent, AFPGraphics2D g2d)`
    `void` | `handleXML(RendererContext context, org.w3c.dom.Document doc, java.lang.String ns)` Handle an external xml document inside a Foreign Object Area.
    `protected void` | `renderSVGDocument(RendererContext rendererContext, org.w3c.dom.Document doc)` Render the SVG document.
    `boolean` | `supportsRenderer(Renderer renderer)` Checks if this XMLHandler supports handling an XML namespace for a particular renderer.
    `protected void` | `updateRendererContext(RendererContext context)` Override this method to update the renderer context if it needs special settings for certain conditions.

    - ### Methods inherited from class org.apache.fop.render.AbstractGenericSVGHandler

      `buildGraphicsNode, createGraphics2DImagePainter, getDocumentURI, getImageSize, getNamespace`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AFPSVGHandler

          public AFPSVGHandler()

  - ### Method Detail

    - #### handleXML

          public void handleXML(RendererContext context,
                                org.w3c.dom.Document doc,
                                java.lang.String ns)
                         throws java.lang.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:
        `java.lang.Exception` - If an error occurs during processing.

    - #### renderSVGDocument

          protected void renderSVGDocument(RendererContext rendererContext,
                                           org.w3c.dom.Document doc)
                                    throws java.io.IOException

      Render the SVG document.
      Overrides:
        `renderSVGDocument` in class `AbstractGenericSVGHandler`
      Parameters:
        `rendererContext` - the renderer context
        `doc` - the SVG document
      Throws:
        `java.io.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

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