SvgImage
Inheritance: java.lang.Object
All Implemented Interfaces: com.aspose.slides.ISvgImage
public class SvgImage implements ISvgImage
Represents an SVG image.
Constructors
| Constructor | Description |
|---|---|
| SvgImage(byte[] data) | Creates new SvgImage object. |
| SvgImage(String svgContent) | Creates new SvgImage object. |
| SvgImage(InputStream stream) | Creates new SvgImage object. |
| SvgImage(byte[] data, IExternalResourceResolver externalResResolver, String baseUri) | Creates new SvgImage object. |
| SvgImage(String svgContent, IExternalResourceResolver externalResResolver, String baseUri) | Creates new SvgImage object. |
| SvgImage(InputStream stream, IExternalResourceResolver externalResResolver, String baseUri) | Creates new SvgImage object. |
Methods
| Method | Description |
|---|---|
| getSvgData() | Returns SVG data. |
| getExternalResourceResolver() | Return callback interface used to resolve external resources during Svg documents import. |
| getBaseUri() | Returns base URI of the specified Svg. |
| getSvgContent() | Returns SVG content. |
| writeAsEmf(OutputStream stream) | Saves the SVG image as an EMF file. |
SvgImage(byte[] data)
public SvgImage(byte[] data)
Creates new SvgImage object.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| data | byte[] | Svg data. |
SvgImage(String svgContent)
public SvgImage(String svgContent)
Creates new SvgImage object.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| svgContent | java.lang.String | Svg content. |
SvgImage(InputStream stream)
public SvgImage(InputStream stream)
Creates new SvgImage object.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| stream | java.io.InputStream | Svg stream. |
SvgImage(byte[] data, IExternalResourceResolver externalResResolver, String baseUri)
public SvgImage(byte[] data, IExternalResourceResolver externalResResolver, String baseUri)
Creates new SvgImage object.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| data | byte[] | Svg data. |
| externalResResolver | IExternalResourceResolver | A callback object used to fetch external objects. If this parameter is null all external objects will be ignored. |
| baseUri | java.lang.String | Base URI of the specified Svg. Used to resolve relative links. |
SvgImage(String svgContent, IExternalResourceResolver externalResResolver, String baseUri)
public SvgImage(String svgContent, IExternalResourceResolver externalResResolver, String baseUri)
Creates new SvgImage object.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| svgContent | java.lang.String | Svg content. |
| externalResResolver | IExternalResourceResolver | A callback object used to fetch external objects. If this parameter is null all external objects will be ignored. |
| baseUri | java.lang.String | Base URI of the specified Svg. Used to resolve relative links. |
SvgImage(InputStream stream, IExternalResourceResolver externalResResolver, String baseUri)
public SvgImage(InputStream stream, IExternalResourceResolver externalResResolver, String baseUri)
Creates new SvgImage object.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| stream | java.io.InputStream | Svg stream. |
| externalResResolver | IExternalResourceResolver | A callback object used to fetch external objects. If this parameter is null all external objects will be ignored. |
| baseUri | java.lang.String | Base URI of the specified Svg. Used to resolve relative links. |
getSvgData()
public final byte[] getSvgData()
Returns SVG data. Read-only byte[].
Returns: byte[]
getExternalResourceResolver()
public final IExternalResourceResolver getExternalResourceResolver()
Return callback interface used to resolve external resources during Svg documents import. Read-only IExternalResourceResolver.
Returns: IExternalResourceResolver
getBaseUri()
public final String getBaseUri()
Returns base URI of the specified Svg. Used to resolve relative links. Read-only String.
Returns: java.lang.String
getSvgContent()
public final String getSvgContent()
Returns SVG content. Read-only String.
Returns: java.lang.String
writeAsEmf(OutputStream stream)
public final void writeAsEmf(OutputStream stream)
Saves the SVG image as an EMF file.
The following example shows how to save the SVG image to the metafile. // Creates the new SVG image ISvgImage svgImage = new SvgImage(new FileInputStream("content.svg")); // Saves the SVG image as a metafille FileOutputStream fileStream = new FileOutputStream("SvgAsEmf.emf"); svgImage.writeAsEmf(fileStream); This sample demonstrates how to add the SVG image as a metafile to the presentation image collection. Presentation pres = new Presentation(); try { // Creates the new SVG image ISvgImage svgImage = new SvgImage(new FileInputStream("content.svg")); ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); // Saves the SVG image as a metafille svgImage.writeAsEmf(byteStream); // Adds metafile to the image collection pres.getImages().addImage(byteStream.toByteArray()); } finally { if (pres != null) pres.dispose(); }
Parameters:
| Parameter | Type | Description |
|---|---|---|
| stream | java.io.OutputStream | Target stream |