public class RtfExternalGraphic extends RtfElement
Modifier and Type | Class and Description |
---|---|
static class |
RtfExternalGraphic.ExternalGraphicException
Exception thrown when an image file/URL cannot be read
|
Modifier and Type | Field and Description |
---|---|
protected int |
graphicCompressionRate
Graphic compression rate
|
protected int |
height
The height of the image
|
protected int |
heightDesired
The desired height
|
protected int |
heightPercent
The desired percent value of the height
|
protected boolean |
perCentH
Flag whether the desired height is a percentage
|
protected boolean |
perCentW
Flag whether the desired width is a percentage
|
protected boolean |
scaleUniform
Flag whether the image size shall be adjusted
|
protected java.net.URL |
url
The url of the image
|
protected int |
width
The width of the image
|
protected int |
widthDesired
The desired width
|
protected int |
widthPercent
The desired percent value of the width
|
m_attrib, m_parent, m_writer
Constructor and Description |
---|
RtfExternalGraphic(RtfContainer container,
java.io.Writer writer)
Default constructor.
|
RtfExternalGraphic(RtfContainer container,
java.io.Writer writer,
RtfAttributes attributes)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getCompressionRate()
Gets the compression rate for the image in percent.
|
boolean |
isEmpty()
true if this element would generate no "useful" RTF content
|
boolean |
setCompressionRate(int percent)
Sets the compression rate for the image in percent.
|
void |
setHeight(java.lang.String theHeight)
Sets the desired height of the image.
|
void |
setScaling(java.lang.String value)
Sets the flag whether the image size shall be adjusted.
|
void |
setURL(java.lang.String urlString)
Sets the url of the image.
|
void |
setWidth(java.lang.String theWidth)
Sets the desired width of the image.
|
protected void |
writeRtfContent()
RtfElement override - catches ExternalGraphicException and writes a warning
message to the document if image cannot be read
|
protected void |
writeRtfContentWithException()
Writes the RTF content to m_writer - this one throws ExternalGraphicExceptions
|
close, dump, getParentOfClass, getRtfAttributes, getRtfFile, isClosed, okToWriteRtf, toString, writeAttributes, writeControlWord, writeControlWordNS, writeExceptionInRtf, writeGroupMark, writeOneAttribute, writeOneAttributeNS, writeRtf, writeRtfPrefix, writeRtfSuffix, writeStarControlWord, writeStarControlWordNS
protected java.net.URL url
protected int height
protected int heightPercent
protected int heightDesired
protected boolean perCentH
protected int width
protected int widthPercent
protected int widthDesired
protected boolean perCentW
protected boolean scaleUniform
protected int graphicCompressionRate
public RtfExternalGraphic(RtfContainer container, java.io.Writer writer) throws java.io.IOException
container
- a RtfContainer
valuewriter
- a Writer
valuejava.io.IOException
public RtfExternalGraphic(RtfContainer container, java.io.Writer writer, RtfAttributes attributes) throws java.io.IOException
container
- a RtfContainer
valuewriter
- a Writer
valueattributes
- a RtfAttributes
valuejava.io.IOException
protected void writeRtfContent() throws java.io.IOException
writeRtfContent
in class RtfElement
java.io.IOException
protected void writeRtfContentWithException() throws java.io.IOException
java.io.IOException
- On errorpublic void setHeight(java.lang.String theHeight)
theHeight
- The desired image heightpublic void setWidth(java.lang.String theWidth)
theWidth
- The desired image widthpublic void setScaling(java.lang.String value)
value
- true image width or height shall be adjusted automatically\n
false no adjustmentpublic void setURL(java.lang.String urlString) throws java.io.IOException
urlString
- Image url like "file://..."java.io.IOException
- On errorpublic int getCompressionRate()
public boolean setCompressionRate(int percent)
percent
- Compression ratepublic boolean isEmpty()
isEmpty
in class RtfElement