public final class EmfImage extends MetaImageBase
Represents one vector image in Enhanced metafile format (EMF) format with its metadata and additional methods
_aspectRatio, _binaryContent, _isDisposed, _linearDimensions, _name, _streamOrigPosition, _textContent, Disposed| Constructor and Description |
|---|
EmfImage(String name,
InputStream binaryContent)
Creates new EmfImage instance from content, represented as byte stream,
and with specified name
|
EmfImage(String name,
String contentInBase64)
Creates new EmfImage instance from content, represented as base64-encoded
string, and with specified name
|
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Disposes this EMF image by disposing its content and making most its
methods and properties non-working
|
InputStream |
getByteContent()
Returns a content of this EMF image as a binary stream
|
String |
getTextContent()
Returns a content of this EMF image as a plain text
|
ImageType |
getType()
Returns ImageType.Emf
|
static boolean |
isValid(InputStream binaryContent)
Checks whether specified stream is a valid EMF image
|
static boolean |
isValid(String contentInBase64)
Checks whether specified base64-encoded string is a valid EMF image
|
void |
save(String fullPathToFile)
Saves this EMF image to the file
|
void |
saveToPng(OutputStream outputPngContent)
Saves this vector EMF image into raster PNG image
|
void |
saveToSvg(OutputStream outputSvgContent)
Saves this vector EMF image into vector SVG image
|
isValidEmf, isValidEmf, isValidWmf, isValidWmfequals, fireDisposedEvent, getAspectRatio, getFilenameWithExtension, getLinearDimensions, getName, isDisposedpublic EmfImage(String name, InputStream binaryContent)
Creates new EmfImage instance from content, represented as byte stream, and with specified name
name - Name of the EMF 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.IllegalArgumentExceptionpublic EmfImage(String name, String contentInBase64)
Creates new EmfImage instance from content, represented as base64-encoded string, and with specified name
name - Name of the EMF image. Cannot be null, empty or whitespaces.contentInBase64 - Content as base64-encoded string. Cannot be null,
empty or whitespaces. If it is not a EMF content, exception will be
thrown.IllegalArgumentExceptionpublic void dispose()
Disposes this EMF image by disposing its content and making most its methods and properties non-working
dispose in interface IDisposabledispose in class VectorImageResourceBasepublic InputStream getByteContent()
Returns a content of this EMF image as a binary stream
getByteContent in interface IHtmlResourcegetByteContent in class VectorImageResourceBasepublic String getTextContent()
Returns a content of this EMF image as a plain text
getTextContent in interface IHtmlResourcegetTextContent in class VectorImageResourceBasepublic ImageType getType()
Returns ImageType.Emf
getType in interface IHtmlResourcegetType in interface IImageResourcegetType in class VectorImageResourceBasepublic static boolean isValid(InputStream binaryContent)
Checks whether specified stream is a valid EMF image
binaryContent - Input byte stream. Cannot be NULL, should support
reading and seeking.public static boolean isValid(String contentInBase64)
Checks whether specified base64-encoded string is a valid EMF image
contentInBase64 - Input string, where content of EMF image is stored
in base64 encoding. Cannot be NULL or empty.public void save(String fullPathToFile)
Saves this EMF 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 EMF
imagepublic void saveToPng(OutputStream outputPngContent)
Saves this vector EMF 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.public void saveToSvg(OutputStream outputSvgContent) throws Exception
Saves this vector EMF image into vector SVG image
saveToSvg in class MetaImageBaseoutputSvgContent - Output stream, into which the content of SVG
image will be written. Cannot be NULL and should be writable.ExceptionCopyright © 2024. All rights reserved.