Class BatikSVGDrawer

  • All Implemented Interfaces:
    SVGDrawer, java.io.Closeable, java.lang.AutoCloseable

    public class BatikSVGDrawer
    extends java.lang.Object
    implements SVGDrawer
    • Field Detail

      • allowedProtocols

        private final java.util.Set<java.lang.String> allowedProtocols
      • allowScripts

        private final boolean allowScripts
      • allowExternalResources

        private final boolean allowExternalResources
    • Constructor Detail

      • BatikSVGDrawer

        public BatikSVGDrawer​(BatikSVGDrawer.SvgScriptMode scriptMode,
                              BatikSVGDrawer.SvgExternalResourceMode externalResourceMode)
        Creates a SVGDrawer that can allow arbitary scripts to run or allow arbitary external resources to be requested. IMPORTANT: External resources include the file:// protocol and may give an attacker access to all files on the system. Scripts may call Javascript or Java code and take control of the system. Please be very sure you are ONLY using trusted SVGs before using this constructor!
      • BatikSVGDrawer

        public BatikSVGDrawer​(BatikSVGDrawer.SvgScriptMode scriptMode,
                              java.util.Set<java.lang.String> allowedProtocols)
        Creates a SVGDrawer that can allow arbitary scripts to run and allow the loading of external resources with the specified protocols.
        Parameters:
        scriptMode -
        allowedProtocols -
      • BatikSVGDrawer

        public BatikSVGDrawer()
        Creates a SVGDrawer that does NOT allow scripts to run or external resources such as file:// or http:// protocol urls to be requested. Recommended for most users.
    • Method Detail

      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
      • addFontFile

        public void addFontFile​(java.io.File fontFile,
                                java.lang.String family,
                                java.lang.Integer weight,
                                BaseRendererBuilder.FontStyle style)
                         throws java.io.IOException,
                                java.awt.FontFormatException
        Specified by:
        addFontFile in interface SVGDrawer
        Throws:
        java.io.IOException
        java.awt.FontFormatException