Class SvgStyleResolver

java.lang.Object
com.itextpdf.svg.css.impl.SvgStyleResolver
All Implemented Interfaces:
ICssResolver

public class SvgStyleResolver extends Object implements ICssResolver
Default implementation of SVG`s styles and attribute resolver .
  • Field Details

  • Constructor Details

    • SvgStyleResolver

      public SvgStyleResolver (InputStream defaultCssStream, SvgProcessorContext context) throws IOException
      Creates a SvgStyleResolver with a given default CSS.
      Parameters:
      defaultCssStream - the default CSS
      context - the processor context
      Throws:
      IOException - if any input/output issue occurs
    • SvgStyleResolver

      public SvgStyleResolver (SvgProcessorContext context)
      Creates a SvgStyleResolver.
      Parameters:
      context - the processor context
    • SvgStyleResolver

      public SvgStyleResolver (INode rootNode, SvgProcessorContext context)
      Creates a SvgStyleResolver. This constructor will instantiate its internal style sheet and it will collect the css declarations from the provided node.
      Parameters:
      rootNode - node to collect css from
      context - the processor context
  • Method Details

    • resolveFontSizeStyle

      public static void resolveFontSizeStyle (Map<String,String> styles, SvgCssContext cssContext, String parentFontSizeStr)
    • isElementNested

      public static boolean isElementNested (IElementNode element, String parentElementNameForSearch)
    • resolveStyles

      public Map<String,String> resolveStyles (INode element, AbstractCssContext context)
      Description copied from interface: ICssResolver
      Resolves the styles of a node given the passed context.
      Specified by:
      resolveStyles in interface ICssResolver
      Parameters:
      element - the node
      context - the CSS context (RootFontSize, etc.)
      Returns:
      the map containing the resolved styles
    • resolveNativeStyles

      public Map<String,String> resolveNativeStyles (INode node, AbstractCssContext cssContext)
      Resolves node styles without inheritance of parent element styles.
      Parameters:
      node - the node
      cssContext - the CSS context (RootFontSize, etc.)
      Returns:
      the map containing the resolved styles that are defined in the body of the element
    • getFonts

      public List<CssFontFaceRule> getFonts()
      Gets the list of fonts.
      Returns:
      the list of CssFontFaceRule instances