SVGElement (Apache FOP Core 2.11 API)
Date: 2025-04-24

org.apache.fop.fo.extensions.svg

## Class SVGElement

- java.lang.Object
- - org.apache.fop.fo.FONode
  - - org.apache.fop.fo.XMLObj
    - - org.apache.fop.fo.extensions.svg.SVGObj
      - - org.apache.fop.fo.extensions.svg.SVGElement

- All Implemented Interfaces:
    Cloneable, EventListener, ContentHandlerFactory.ObjectBuiltListener

      public class SVGElement
      extends SVGObj

  Class representing the SVG root element for constructing an SVG document.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `SVGElement.PDFUnitContext` This class is the default context for a particular element.

    - ### Nested classes/interfaces inherited from class org.apache.fop.fo.FONode

      `FONode.FONodeIterator, FONode.GatherContextInfoFunction`

  - ### Field Summary

    - ### Fields inherited from class org.apache.fop.fo.XMLObj

      `doc, element, name`

    - ### Fields inherited from class org.apache.fop.fo.FONode

      `FO_URI, FOX_URI, locator, log, nodeChangeBarList, parent, siblings, startOfNodeChangeBarList`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SVGElement(FONode parent)` Constructs an SVG object

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ContentHandlerFactory` | `getContentHandlerFactory()` This method is overridden by extension elements and allows the extension element to return a `ContentHandlerFactory`.
    `Point2D` | `getDimension(Point2D view)` Get the dimensions of this XML document.
    `static Point2D` | `getSize(int size, Element svgRoot, float ptmm)` Get the size of the SVG root element.

    - ### Methods inherited from class org.apache.fop.fo.extensions.svg.SVGObj

      `getNamespaceURI, getNormalNamespacePrefix`

    - ### Methods inherited from class org.apache.fop.fo.XMLObj

      `addChildNode, addElement, buildTopLevel, characters, createBasicDocument, getDOMDocument, getIntrinsicAlignmentAdjust, getLocalName, notifyObjectBuilt, processNode, validateChildNode`

    - ### Methods inherited from class org.apache.fop.fo.FONode

      `addCharacters, attachSiblings, bind, canHaveMarkers, charIterator, clone, clone, collectDelimitedTextRanges, collectDelimitedTextRanges, createPropertyList, decorateWithContextInfo, endOfNode, errorText, finalizeNode, gatherContextInfo, getBuilderContext, getChangeBarList, getChildNodes, getChildNodes, getContextInfo, getContextInfoAlt, getExtensionAttachment, getFOEventHandler, getFOValidationEventProducer, getLocator, getLocatorString, getLogger, getName, getName, getNameId, getNodePrefix, getNodeString, getParent, getRoot, getStructureTreeElement, getUserAgent, inMarker, invalidChildError, invalidChildError, invalidPropertyValueError, isBidiRangeBlockItem, isChangeBarElement, isDelimitedTextRangeBoundary, missingChildElementError, missingChildElementError, missingPropertyError, nodesOutOfOrderError, nodesOutOfOrderError, notSupportedChildError, removeChild, setLocator, setStructureTreeElement, startOfNode, tooManyNodesError, tooManyNodesError, tooManyNodesError, validateChildNode, warningText`

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

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

- - ### Constructor Detail

    - #### SVGElement

          public SVGElement(FONode parent)

      Constructs an SVG object
      Parameters:
        `parent` - the parent formatting object

  - ### Method Detail

    - #### getContentHandlerFactory

          public ContentHandlerFactory getContentHandlerFactory()

      This method is overridden by extension elements and allows the extension element to return a `ContentHandlerFactory`. This factory can create ContentHandler implementations that handle foreign XML content by either building up a specific DOM, a Java object or something else.
      Overrides:
        `getContentHandlerFactory` in class `FONode`
      Returns:
        the `ContentHandlerFactory` or `null` if not applicable

    - #### getDimension

          public Point2D getDimension(Point2D view)

      Get the dimensions of this XML document.
      Overrides:
        `getDimension` in class `XMLObj`
      Parameters:
        `view` - the viewport dimensions
      Returns:
        the dimensions of this SVG document

    - #### getSize

          public static Point2D getSize(int size,
                                        Element svgRoot,
                                        float ptmm)

      Get the size of the SVG root element.
      Parameters:
        `size` - the font size
        `svgRoot` - the svg root element
        `ptmm` - the pixel to millimeter conversion factor
      Returns:
        the size of the SVG document

Copyright © 2025 Apache Software Foundation. All rights reserved.