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

Class SvgImage

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

      Fields 
      Modifier and Type Field and Description
      com.groupdocs.editor.events.ProcessEvents<com.groupdocs.editor.events.ProcessEventHandler> Disposed
      Event, which occurs right after when this SVG image is disposed
    • 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
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void dispose()
      Disposes this raster image, disposing its content and making most methods and properties non-working
      boolean equals(IHtmlResource other)
      Checks this instance with specified on reference equality.
      boolean equals(Object obj)
      Determines whether the specified Object is equal to the current Object.
      Ratio getAspectRatio()
      Returns aspect ratio of this SVG image
      InputStream getByteContent()
      Returns a content of this SVG image as a binary stream
      String getFilenameWithExtension()
      Returns correct filename of this SVG image, which consists of name and extension.
      Dimensions getLinearDimensions()
      Returns linear dimensions of this SVG image (width and height), if they are present, or empty default Dimensions instance otherwise
      String getName()
      Returns name of this SVG image.
      String getTextContent()
      Returns a content of this SVG image as a plain text (in XML format)
      ImageType getType()
      Returns ImageType.Svg
      int hashCode()
      Serves as a hash function for a particular type.
      boolean isDisposed()
      Determines whether this SVG image is disposed or not
      static boolean isValid(String content)
      Performs a surface check whether specified textual content represents a SVG image
      void save(String fullPathToFile)
      Saves this SVG image to the file
    • Field Detail

      • Disposed

        public final com.groupdocs.editor.events.ProcessEvents<com.groupdocs.editor.events.ProcessEventHandler> Disposed

        Event, which occurs right after when this SVG image is disposed

    • Constructor Detail

      • SvgImage

        public SvgImage(String name,
                InputStream binaryContent)

        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:
        Exception
        com.groupdocs.editor.htmlcss.exceptions.InvalidImageFormatException
      • SvgImage

        public SvgImage(String name,
                String content)

        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.
    • 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 - IHtmlResource
        Returns:
      • equals

        public boolean equals(Object obj)

        Determines whether the specified Object is equal to the current Object.

        Overrides:
        equals in class Object
      • 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()

        Returns a content of this SVG image as a plain text (in XML format)

        Specified by:
        getTextContent in interface IHtmlResource
      • hashCode

        public int hashCode()

        Serves as a hash function for a particular type.

        Overrides:
        hashCode in class Object
      • isDisposed

        public boolean isDisposed()

        Determines whether this SVG image is disposed or not

        Specified by:
        isDisposed in interface IAuxDisposable
      • isValid

        public static boolean isValid(String content)

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

        Parameters:
        content - Specified textual content.
        Returns:
      • save

        public void save(String fullPathToFile)

        Saves this SVG image to the file

        Specified by:
        save in interface IHtmlResource
        Parameters:
        fullPathToFile - Full path to the file, which will be created (if it doesn't exist) or overwritten (if exists) with the content of this SVG image