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

Class SvgImage

    • 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 seekable. If this instance will be disposed, this stream will be disposed too.
        Throws:
        IllegalArgumentException
        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, which contains a valid XML-compliant content of SVG image. Cannot be null, empty or whitespaces. If it is not a SVG content, exception will be thrown.
        Throws:
        IllegalArgumentException - Some of parameters are invalid
        InvalidImageFormatException - content argument contains invalid SVG content
    • 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 IDisposable
        Specified by:
        dispose in class VectorImageResourceBase
      • getXmlContent

        public final String getXmlContent()

        Returns a content of this SVG image int its original XML-compliant textual form

        Returns:
        Throws:
        com.aspose.ms.System.ObjectDisposedException - Thrown when this instance was already disposed
      • isValid

        public static boolean isValid(String content)

        Performs a surface check whether specified textual XML-compliant content represents a SVG image

        Parameters:
        content - XML content of an SVG image as simple text, not a base64-encoded content
        Returns:
        True if specified string can be treated as valid SVG at first look, false if it is not SVG for sure
      • save

        public void save(String fullPathToFile)

        Saves this SVG image to the file

        Specified by:
        save in interface IHtmlResource
        Specified by:
        save in class VectorImageResourceBase
        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
      • saveToPng

        public void saveToPng(InputStream outputPngContent)

        Saves this vector SVG image into raster PNG image

        Specified by:
        saveToPng in class VectorImageResourceBase
        Parameters:
        outputPngContent - Output stream, into which the content of PNG image will be written. Cannot be NULL and should be writable.