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

org.apache.fop.svg

## Class SimpleSVGUserAgent

- java.lang.Object
- - org.apache.batik.bridge.UserAgentAdapter
  - - org.apache.fop.svg.SimpleSVGUserAgent

- All Implemented Interfaces:
    org.apache.batik.bridge.UserAgent
  Direct Known Subclasses:
    SVGUserAgent

      public class SimpleSVGUserAgent
      extends org.apache.batik.bridge.UserAgentAdapter

  A simple SVG user agent. This is an implementation of the Batik SVG user agent. It ignores any message output sent by Batik.

- - ### Field Summary

    - ### Fields inherited from class org.apache.batik.bridge.UserAgentAdapter

      `ctx, extensions, FEATURES`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleSVGUserAgent(AffineTransform at, org.apache.batik.bridge.FontFamilyResolver fontFamilyResolver, float sourceResolution)` Creates a new user agent.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.apache.batik.bridge.FontFamilyResolver` | `getFontFamilyResolver()`
    `String` | `getLanguages()` Returns the language settings.
    `String` | `getMedia()` Returns the media type for this rendering.
    `float` | `getMediumFontSize()`
    `float` | `getPixelUnitToMillimeter()` Returns a customized the pixel to mm factor.
    `AffineTransform` | `getTransform()` Get the transform of the SVG document.
    `String` | `getUserStyleSheetURI()` Returns the user stylesheet URI.
    `Dimension2D` | `getViewportSize()` Get the default viewport size for an SVG document.
    `String` | `getXMLParserClassName()` Returns the class name of the XML parser.
    `boolean` | `isXMLParserValidating()` Is the XML parser validating.
    `void` | `setTransform(AffineTransform at)`

    - ### Methods inherited from class org.apache.batik.bridge.UserAgentAdapter

      `addStdFeatures, checkLoadExternalResource, checkLoadScript, deselectAll, displayError, displayError, displayMessage, getAlternateStyleSheet, getBolderFontWeight, getBrokenLinkDocument, getClientAreaLocationOnScreen, getDefaultFontFamily, getEventDispatcher, getExternalResourceSecurity, getLighterFontWeight, getPixelToMM, getScriptSecurity, getSourceResolution, getStandardBolderFontWeight, getStandardLighterFontWeight, handleElement, hasFeature, loadDocument, openLink, registerExtension, runThread, setBridgeContext, setSourceResolution, setSVGCursor, setTextSelection, showAlert, showConfirm, showPrompt, showPrompt, supportExtension`

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

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

- - ### Constructor Detail

    - #### SimpleSVGUserAgent

          public SimpleSVGUserAgent(AffineTransform at,
                                    org.apache.batik.bridge.FontFamilyResolver fontFamilyResolver,
                                    float sourceResolution)

      Creates a new user agent.
      Parameters:
        `at` - the current transform

  - ### Method Detail

    - #### getPixelUnitToMillimeter

          public float getPixelUnitToMillimeter()

      Returns a customized the pixel to mm factor.
      Specified by:
        `getPixelUnitToMillimeter` in interface `org.apache.batik.bridge.UserAgent`
      Overrides:
        `getPixelUnitToMillimeter` in class `org.apache.batik.bridge.UserAgentAdapter`
      Returns:
        the pixel unit to millimeter conversion factor

    - #### getMediumFontSize

          public float getMediumFontSize()

      Specified by:
        `getMediumFontSize` in interface `org.apache.batik.bridge.UserAgent`
      Overrides:
        `getMediumFontSize` in class `org.apache.batik.bridge.UserAgentAdapter`
      Returns:
        medium font size adapted to the resolution

    - #### getLanguages

          public String getLanguages()

      Returns the language settings.
      Specified by:
        `getLanguages` in interface `org.apache.batik.bridge.UserAgent`
      Overrides:
        `getLanguages` in class `org.apache.batik.bridge.UserAgentAdapter`
      Returns:
        the languages supported

    - #### getMedia

          public String getMedia()

      Returns the media type for this rendering.
      Specified by:
        `getMedia` in interface `org.apache.batik.bridge.UserAgent`
      Overrides:
        `getMedia` in class `org.apache.batik.bridge.UserAgentAdapter`
      Returns:
        the media for FO documents is "print"

    - #### getUserStyleSheetURI

          public String getUserStyleSheetURI()

      Returns the user stylesheet URI.
      Specified by:
        `getUserStyleSheetURI` in interface `org.apache.batik.bridge.UserAgent`
      Overrides:
        `getUserStyleSheetURI` in class `org.apache.batik.bridge.UserAgentAdapter`
      Returns:
        null if no user style sheet was specified.

    - #### getXMLParserClassName

          public String getXMLParserClassName()

      Returns the class name of the XML parser.
      Specified by:
        `getXMLParserClassName` in interface `org.apache.batik.bridge.UserAgent`
      Overrides:
        `getXMLParserClassName` in class `org.apache.batik.bridge.UserAgentAdapter`
      Returns:
        the XML parser class name

    - #### isXMLParserValidating

          public boolean isXMLParserValidating()

      Is the XML parser validating.
      Specified by:
        `isXMLParserValidating` in interface `org.apache.batik.bridge.UserAgent`
      Overrides:
        `isXMLParserValidating` in class `org.apache.batik.bridge.UserAgentAdapter`
      Returns:
        true if the XML parser is validating

    - #### getTransform

          public AffineTransform getTransform()

      Get the transform of the SVG document.
      Specified by:
        `getTransform` in interface `org.apache.batik.bridge.UserAgent`
      Overrides:
        `getTransform` in class `org.apache.batik.bridge.UserAgentAdapter`
      Returns:
        the transform

    - #### setTransform

          public void setTransform(AffineTransform at)

      Specified by:
        `setTransform` in interface `org.apache.batik.bridge.UserAgent`
      Overrides:
        `setTransform` in class `org.apache.batik.bridge.UserAgentAdapter`

    - #### getViewportSize

          public Dimension2D getViewportSize()

      Get the default viewport size for an SVG document. This returns a default value of 100x100.
      Specified by:
        `getViewportSize` in interface `org.apache.batik.bridge.UserAgent`
      Overrides:
        `getViewportSize` in class `org.apache.batik.bridge.UserAgentAdapter`
      Returns:
        the default viewport size

    - #### getFontFamilyResolver

          public org.apache.batik.bridge.FontFamilyResolver getFontFamilyResolver()

      Specified by:
        `getFontFamilyResolver` in interface `org.apache.batik.bridge.UserAgent`
      Overrides:
        `getFontFamilyResolver` in class `org.apache.batik.bridge.UserAgentAdapter`

Copyright © 2025 Apache Software Foundation. All rights reserved.