@OpenApiAll public class RTFFormatter extends DefaultFormatter
Modifier and Type | Field and Description |
---|---|
static float |
HMM_PER_INCH
The number of hundredths of millimeters (0.01 mm) in an inch.
|
static java.lang.String |
LINKED_PICTURE
The image property indicates that image will be temporary stored as a link during process and it
will be replaced with binary data in post-process.
|
static float |
MAX_HEIGHT_IN_PIXELS
The number of appropriate max image height in pixels.
|
static float |
MAX_WIDTH_IN_PIXELS
The number of appropriate max image width in pixels.
|
static float |
TWIPS_PER_INCH
The number of twips in an inch.
|
protected static int |
WMF_PLACEABLE_HEADER_SIZE
The number of WMF header length.
|
dpi, properties, styledDocument
DOT_PER_INCH
Constructor and Description |
---|
RTFFormatter(java.util.Properties properties)
Create a RTF formatter with with specific properties.
|
Modifier and Type | Method and Description |
---|---|
protected ITool.RetainedString |
createBookmark(Bookmark bookmark)
Create a RTF bookmark string from given
Bookmark object. |
protected ITool.RetainedString |
createImage(Image image)
Create a RTF image string from given
Image object. |
protected ITool.RetainedString |
createImage(Image image,
int width,
int height,
int flag)
Create a RTF image string from given
Image object. |
long |
createImageBody(Image image,
java.io.Writer writer)
Create image body to writer.
|
protected ITool.RetainedString |
createImageFooter(Image image,
int width,
int height,
int flag)
Create an image footer.
|
protected ITool.RetainedString |
createImageHeader(Image image,
int width,
int height,
int flag)
Create an image header.
|
protected ITool.RetainedString |
createImageProperty(float w,
float h,
int flag)
Calculate Property of image.
|
protected ITool.RetainedString |
createLink(Link link)
Create a RTF link string from given
Link object. |
java.lang.Object |
format(java.lang.Object value)
Convert an Object value into RTF format.
|
protected java.lang.String |
getImageFormat(Image image)
Return the image format.
|
float[] |
getPageSize()
Calculation for total paper width and total paper height after minus margin of page in twips.
|
protected boolean |
isLargeImage(Image image)
Compare the width and height of the image and paper if the image is greater than paper, it's considered as
large image.
|
getImageFlag, getObjectFormater, getProperties, registerObjectFormatter, setProperties, setStyledDocument, writeImage, writeImage
public static final float HMM_PER_INCH
public static final float TWIPS_PER_INCH
public static final float MAX_WIDTH_IN_PIXELS
public static final float MAX_HEIGHT_IN_PIXELS
public static final java.lang.String LINKED_PICTURE
protected static final int WMF_PLACEABLE_HEADER_SIZE
public RTFFormatter(java.util.Properties properties)
properties
- template propertiespublic java.lang.Object format(java.lang.Object value)
format
in interface IFormatter
format
in class DefaultFormatter
value
- converting valueprotected ITool.RetainedString createImage(Image image) throws java.io.IOException
Image
object.image
- an Image
objectjava.io.IOException
- when IO error occursprotected ITool.RetainedString createImage(Image image, int width, int height, int flag) throws java.io.IOException
Image
object.image
- an Image
objectwidth
- the target image widthheight
- the target image heightflag
- scaling image flagjava.io.IOException
- when IO error occursprotected ITool.RetainedString createImageHeader(Image image, int width, int height, int flag)
image
- Image objectwidth
- target image widthheight
- target image heightflag
- target image flagcreateImageProperty(float, float, int)
public long createImageBody(Image image, java.io.Writer writer) throws java.io.IOException
image
- an Image objectwriter
- the writerjava.io.IOException
- if exception occursprotected ITool.RetainedString createImageFooter(Image image, int width, int height, int flag)
image
- Image objectwidth
- target image widthheight
- target image heightflag
- target image flagcreateImageProperty(float, float, int)
protected ITool.RetainedString createImageProperty(float w, float h, int flag)
picscalex - scale in x
picscaley - scale in y
picw - Width of image(0.01 mm)
pich - Height of image(0.01 mm)
picwgoal - Width of image(twips)
pichgoal - Height of image(twips)
Units Used
----------
1 Twip = 1/20 Point
1 Point = 1/72 Inch
1 Twip = 1/1440 Inch
1 Inch = 2.54 cm
1 Inch = 25.4 mm
1 Inch = 2540 (0.01)mm
w
- image widthh
- image heightflag
- scaling image flagprotected java.lang.String getImageFormat(Image image)
image
- the Imagepublic float[] getPageSize()
protected boolean isLargeImage(Image image)
image
- image want to compare with paperprotected ITool.RetainedString createBookmark(Bookmark bookmark) throws java.io.IOException
Bookmark
object.bookmark
- an Bookmark
objectjava.io.IOException
- when IO error occursprotected ITool.RetainedString createLink(Link link) throws java.io.IOException
Link
object.link
- an Link
objectjava.io.IOException
- when IO error occursCopyright © 2010 - No Magic Asia