public final class SvgImage extends VectorImageResourceBase
Represents one vector image in SVG (Scalable Vector Graphics) format with its metadata and additional methods
Disposed
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
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes this raster image, disposing its content and making most methods
and properties non-working
|
InputStream |
getByteContent()
Returns a content of this SVG image as a binary stream
|
String |
getTextContent()
Returns a content of this SVG image as a plain text (in XML format)
|
ImageType |
getType()
Returns ImageType.Svg
|
String |
getXmlContent()
Returns a content of this SVG image int its original XML-compliant
textual form
|
static boolean |
isValid(String content)
Performs a surface check whether specified textual XML-compliant content
represents a SVG image
|
void |
save(String fullPathToFile)
Saves this SVG image to the file
|
void |
saveToPng(InputStream outputPngContent)
Saves this vector SVG image into raster PNG image
|
equals, getAspectRatio, getFilenameWithExtension, getLinearDimensions, getName, isDisposed
public SvgImage(String name, InputStream binaryContent)
Creates new SvgImage instance from content, represented as byte stream, and with specified name
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.IllegalArgumentException
InvalidImageFormatException
public SvgImage(String name, String content)
Creates new SvgImage instance from content, represented as usual string, and with specified name
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.IllegalArgumentException
- Some of parameters are invalidInvalidImageFormatException
- content
argument contains
invalid SVG contentpublic void dispose()
Disposes this raster image, disposing its content and making most methods and properties non-working
dispose
in interface IDisposable
dispose
in class VectorImageResourceBase
public InputStream getByteContent()
Returns a content of this SVG image as a binary stream
getByteContent
in interface IHtmlResource
getByteContent
in class VectorImageResourceBase
public String getTextContent()
Returns a content of this SVG image as a plain text (in XML format)
getTextContent
in interface IHtmlResource
getTextContent
in class VectorImageResourceBase
public ImageType getType()
Returns ImageType.Svg
getType
in interface IHtmlResource
getType
in interface IImageResource
getType
in class VectorImageResourceBase
public final String getXmlContent()
Returns a content of this SVG image int its original XML-compliant textual form
com.aspose.ms.System.ObjectDisposedException
- Thrown when this instance was already
disposedpublic static boolean isValid(String content)
Performs a surface check whether specified textual XML-compliant content represents a SVG image
content
- XML content of an SVG image as simple text, not a
base64-encoded contentpublic void save(String fullPathToFile)
Saves this SVG image to the file
save
in interface IHtmlResource
save
in class VectorImageResourceBase
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
imagepublic void saveToPng(InputStream outputPngContent)
Saves this vector SVG image into raster PNG image
saveToPng
in class VectorImageResourceBase
outputPngContent
- Output stream, into which the content of PNG
image will be written. Cannot be NULL and should be writable.