com.groupdocs.editor.htmlcss.resources.images.vector

Class SvgImage

  • java.lang.Object
    • com.groupdocs.editor.htmlcss.resources.images.vector.SvgImage
    • Constructor Summary

      Constructors 
      Constructor and Description
      SvgImage(String name, InputStream binaryContent)
      Creates new SvgImage instance from content, represented as byte stream, and with specified name
      SvgImage(String name, String content)
      Creates new SvgImage instance from content, represented as usual string, and with specified name
    • Constructor Detail

      • SvgImage

        public SvgImage(String name,
                InputStream binaryContent)
                 throws Exception

        Creates new SvgImage instance from content, represented as byte stream, and with specified name

        Parameters:
        name - Name of the SVG image. Cannot be null, empty or whitespaces.
        binaryContent - Content as byte stream. Reading begins from original position. Cannot be null. Should be readable and seakable. If this instance will be disposed, this stream will be disposed too.
        Throws:
        com.aspose.ms.System.ArgumentException
        com.groupdocs.editor.htmlcss.exceptions.InvalidImageFormatException
        Exception
      • SvgImage

        public SvgImage(String name,
                String content)
                 throws Exception

        Creates new SvgImage instance from content, represented as usual string, and with specified name

        Parameters:
        name - Name of the SVG image. Cannot be null, empty or whitespaces.
        content - Content as a usual string. Cannot be null, empty or whitespaces. If it is not a SVG content, exception will be thrown.
        Throws:
        Exception
    • Method Detail

      • dispose

        public void dispose()

        Disposes this raster image, disposing its content and making most methods and properties non-working

        Specified by:
        dispose in interface com.aspose.ms.System.IDisposable
      • equals

        public boolean equals(IHtmlResource other)

        Checks this instance with specified on reference equality.

        Parameters:
        other -
        Returns:
      • getFilenameWithExtension

        public String getFilenameWithExtension()

        Returns correct filename of this SVG image, which consists of name and extension. Theoretically can differ from the name.

        Specified by:
        getFilenameWithExtension in interface IHtmlResource
      • getLinearDimensions

        public Dimensions getLinearDimensions()

        Returns linear dimensions of this SVG image (width and height), if they are present, or empty default Dimensions instance otherwise

        Specified by:
        getLinearDimensions in interface IImageResource
      • getName

        public String getName()

        Returns name of this SVG image. Usually doesn't contain filename extension and theoretically can differ from filename.

        Specified by:
        getName in interface IHtmlResource
      • getTextContent

        public String getTextContent()
        Description copied from interface: IHtmlResource
        Content of the HTML resource in a form of a base64-encoded text string for binary resources or a simple text for textual resources
        Specified by:
        getTextContent in interface IHtmlResource
      • isValid

        public static boolean isValid(String content)
                               throws Exception

        Performs a surface check whether specified textual content represents a SVG image

        Parameters:
        content -
        Returns:
        Throws:
        Exception
      • save

        public void save(String fullPathToFile)
        Description copied from interface: IHtmlResource
        Saves a current resource to the specified file
        Specified by:
        save in interface IHtmlResource