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

org.apache.fop.fo.extensions.svg

## Class SVGElement.PDFUnitContext

- java.lang.Object
- - org.apache.fop.fo.extensions.svg.SVGElement.PDFUnitContext

- All Implemented Interfaces:
    org.apache.batik.parser.UnitProcessor.Context
  Enclosing class:
    SVGElement

      public static class SVGElement.PDFUnitContext
      extends Object
      implements org.apache.batik.parser.UnitProcessor.Context

  This class is the default context for a particular element. Information not available on the element are obtained from the bridge context (such as the viewport or the pixel to millimeter factor.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PDFUnitContext(int size, Element e, float ptmm)` Create a PDF unit context.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Element` | `getElement()` Returns the element.
    `float` | `getFontSize()` Returns the font-size value.
    `org.apache.batik.parser.UnitProcessor.Context` | `getParentElementContext()` Returns the context of the parent element of this context.
    `float` | `getPixelToMM()` Returns the pixel to mm factor.
    `float` | `getPixelUnitToMillimeter()` Returns the pixel to mm factor.
    `float` | `getViewportHeight()` Returns the viewport height used to compute units.
    `float` | `getViewportWidth()` Returns the viewport width used to compute units.
    `float` | `getXHeight()` Returns the x-height value.

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

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

- - ### Constructor Detail

    - #### PDFUnitContext

          public PDFUnitContext(int size,
                                Element e,
                                float ptmm)

      Create a PDF unit context.
      Parameters:
        `size` - the font size.
        `e` - the svg element
        `ptmm` - the pixel to millimeter factor

  - ### Method Detail

    - #### getElement

          public Element getElement()

      Returns the element.
      Specified by:
        `getElement` in interface `org.apache.batik.parser.UnitProcessor.Context`
      Returns:
        the element

    - #### getParentElementContext

          public org.apache.batik.parser.UnitProcessor.Context getParentElementContext()

      Returns the context of the parent element of this context. Since this is always for the root SVG element there never should be one...
      Returns:
        null

    - #### getPixelToMM

          public float getPixelToMM()

      Returns the pixel to mm factor. (this is deprecated)
      Specified by:
        `getPixelToMM` in interface `org.apache.batik.parser.UnitProcessor.Context`
      Returns:
        the pixel to millimeter factor

    - #### getPixelUnitToMillimeter

          public float getPixelUnitToMillimeter()

      Returns the pixel to mm factor.
      Specified by:
        `getPixelUnitToMillimeter` in interface `org.apache.batik.parser.UnitProcessor.Context`
      Returns:
        the pixel to millimeter factor

    - #### getFontSize

          public float getFontSize()

      Returns the font-size value.
      Specified by:
        `getFontSize` in interface `org.apache.batik.parser.UnitProcessor.Context`
      Returns:
        the default font size

    - #### getXHeight

          public float getXHeight()

      Returns the x-height value.
      Specified by:
        `getXHeight` in interface `org.apache.batik.parser.UnitProcessor.Context`
      Returns:
        the x-height value

    - #### getViewportWidth

          public float getViewportWidth()

      Returns the viewport width used to compute units.
      Specified by:
        `getViewportWidth` in interface `org.apache.batik.parser.UnitProcessor.Context`
      Returns:
        the default viewport width of 100

    - #### getViewportHeight

          public float getViewportHeight()

      Returns the viewport height used to compute units.
      Specified by:
        `getViewportHeight` in interface `org.apache.batik.parser.UnitProcessor.Context`
      Returns:
        the default viewport height of 100

Copyright © 2025 Apache Software Foundation. All rights reserved.