public final class SvgImage extends VectorImageResourceBase
Represents one vector image in SVG (Scalable Vector Graphics) format with its metadata and additional methods
_aspectRatio, _binaryContent, _isDisposed, _linearDimensions, _name, _streamOrigPosition, _textContent, 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(OutputStream outputPngContent)
Saves this vector SVG image into raster PNG image
|
equals, fireDisposedEvent, getAspectRatio, getFilenameWithExtension, getLinearDimensions, getName, isDisposedpublic 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.IllegalArgumentExceptionInvalidImageFormatExceptionpublic 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 IDisposabledispose in class VectorImageResourceBasepublic InputStream getByteContent()
Returns a content of this SVG image as a binary stream
getByteContent in interface IHtmlResourcegetByteContent in class VectorImageResourceBasepublic String getTextContent()
Returns a content of this SVG image as a plain text (in XML format)
getTextContent in interface IHtmlResourcegetTextContent in class VectorImageResourceBasepublic ImageType getType()
Returns ImageType.Svg
getType in interface IHtmlResourcegetType in interface IImageResourcegetType in class VectorImageResourceBasepublic 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 IHtmlResourcesave in class VectorImageResourceBasefullPathToFile - 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(OutputStream outputPngContent)
Saves this vector SVG image into raster PNG image
saveToPng in class VectorImageResourceBaseoutputPngContent - Output stream, into which the content of PNG
image will be written. Cannot be NULL and should be writable.Copyright © 2024. All rights reserved.