| java.lang.Object com.lowagie.text.Chunk
All known Subclasses: com.lowagie.text.rtf.RtfAddableElement, com.lowagie.text.rtf.field.RtfField, com.lowagie.text.rtf.RtfTOC, com.lowagie.text.rtf.AbstractRtfField, com.lowagie.text.rtf.RtfTOCEntry,
Chunk | public class Chunk implements Element(Code) | | This is the smallest significant part of text that can be added to a
document.
Most elements can be divided in one or more Chunk s. A chunk
is a String with a certain Font . All other
layout parameters should be defined in the object to which this chunk of text
is added.
Example:
Chunk chunk = new Chunk("Hello world",
FontFactory.getFont(FontFactory.COURIER, 20, Font.ITALIC, new Color(255, 0,
0))); document.add(chunk);
|
Constructor Summary | |
public | Chunk() Empty constructor. | public | Chunk(Chunk ck) A Chunk copy constructor. | public | Chunk(String content, Font font) Constructs a chunk of text with a certain content and a certain
Font . | public | Chunk(String content) Constructs a chunk of text with a certain content, without specifying a
Font . | public | Chunk(char c, Font font) Constructs a chunk of text with a char and a certain Font . | public | Chunk(char c) Constructs a chunk of text with a char, without specifying a Font
. | public | Chunk(Image image, float offsetX, float offsetY) Constructs a chunk containing an Image . | public | Chunk(Image image, float offsetX, float offsetY, boolean changeLeading) Constructs a chunk containing an Image . | public | Chunk(java.util.Properties attributes) Returns a Chunk that has been constructed taking in
account the value of some attributes . |
Method Summary | |
public static Object[][] | addToArray(Object original, Object item) Utility method to extend an array. | public StringBuffer | append(String string) appends some text to this Chunk . | public String | content() Returns the content of this Chunk . | public Font | font() Gets the font of this Chunk . | public HashMap | getAttributes() Gets the attributes for this Chunk . | public ArrayList | getChunks() Gets all the chunks in this element. | public String | getContent() Returns the content of this Chunk . | public Font | getFont() Gets the font of this Chunk . | public float | getHorizontalScaling() Gets the horizontal scaling. | public Image | getImage() Returns the image. | public static Set | getKeySet(Hashtable table) | public float | getTextRise() Gets the text displacement relatiev to the baseline. | public float | getWidthPoint() Gets the width of the Chunk in points. | public boolean | hasAttributes() Checks the attributes of this Chunk . | public boolean | isEmpty() Checks is this Chunk is empty. | public boolean | process(ElementListener listener) Processes the element by adding it (or the different parts) to an
ElementListener . | public Chunk | setAction(PdfAction action) Sets an action for this Chunk . | public Chunk | setAnchor(URL url) Sets an anchor for this Chunk . | public Chunk | setAnchor(String url) Sets an anchor for this Chunk . | public Chunk | setAnnotation(PdfAnnotation annotation) Sets a generic annotation to this Chunk . | public void | setAttributes(HashMap attributes) Sets the attributes all at once. | public Chunk | setBackground(Color color) Sets the color of the background Chunk . | public Chunk | setBackground(Color color, float extraLeft, float extraBottom, float extraRight, float extraTop) Sets the color and the size of the background Chunk . | public void | setFont(Font font) Sets the font of this Chunk . | public Chunk | setGenericTag(String text) Sets the generic tag Chunk . | public Chunk | setHorizontalScaling(float scale) Sets the text horizontal scaling. | public Chunk | setHyphenation(HyphenationEvent hyphenation) sets the hyphenation engine to this Chunk . | public Chunk | setLocalDestination(String name) Sets a local destination for this Chunk . | public Chunk | setLocalGoto(String name) Sets a local goto for this Chunk . | public Chunk | setNewPage() Sets a new page tag.. | public Chunk | setRemoteGoto(String filename, String name) Sets a goto for a remote destination for this Chunk . | public Chunk | setRemoteGoto(String filename, int page) Sets a goto for a remote destination for this Chunk .
Parameters: filename - the file name of the destination document Parameters: page - the page of the destination to go to. | public Chunk | setSkew(float alpha, float beta) Skews the text to simulate italic and other effects. | public Chunk | setSplitCharacter(SplitCharacter splitCharacter) Sets the split characters. | public Chunk | setTextRenderMode(int mode, float strokeWidth, Color strokeColor) Sets the text rendering mode. | public Chunk | setTextRise(float rise) Sets the text displacement relative to the baseline. | public Chunk | setUnderline(float thickness, float yPosition) Sets an horizontal line that can be an underline or a strikethrough.
Actually, the line can be anywhere vertically and has always the
Chunk width. | public Chunk | setUnderline(Color color, float thickness, float thicknessMul, float yPosition, float yPositionMul, int cap) Sets an horizontal line that can be an underline or a strikethrough.
Actually, the line can be anywhere vertically and has always the
Chunk width. | public String | toString() Returns the content of this Chunk . | public int | type() Gets the type of the text element. |
ACTION | final public static String ACTION(Code) | | Key for Action.
|
BACKGROUND | final public static String BACKGROUND(Code) | | Key for background.
|
ENCODING | final public static String ENCODING(Code) | | Key for encoding.
|
GENERICTAG | final public static String GENERICTAG(Code) | | Key for generic tag.
|
HSCALE | final public static String HSCALE(Code) | | Key for text horizontal scaling.
|
HYPHENATION | final public static String HYPHENATION(Code) | | Key for hyphenation.
|
LOCALDESTINATION | final public static String LOCALDESTINATION(Code) | | Key for local destination.
|
LOCALGOTO | final public static String LOCALGOTO(Code) | | Key for local goto.
|
NEWLINE | final public static Chunk NEWLINE(Code) | | This is a Chunk containing a newline.
|
NEWPAGE | final public static String NEWPAGE(Code) | | Key for newpage.
|
NEXTPAGE | final public static Chunk NEXTPAGE(Code) | | This is a Chunk containing a newpage.
|
OBJECT_REPLACEMENT_CHARACTER | final public static String OBJECT_REPLACEMENT_CHARACTER(Code) | | The character stand in for an image.
|
PDFANNOTATION | final public static String PDFANNOTATION(Code) | | Key for annotation.
|
REMOTEGOTO | final public static String REMOTEGOTO(Code) | | Key for remote goto.
|
SKEW | final public static String SKEW(Code) | | Key for text skewing.
|
SPLITCHARACTER | final public static String SPLITCHARACTER(Code) | | Key for split character.
|
SUBSUPSCRIPT | final public static String SUBSUPSCRIPT(Code) | | Key for sub/superscript.
|
TEXTRENDERMODE | final public static String TEXTRENDERMODE(Code) | | Key for text rendering mode.
|
UNDERLINE | final public static String UNDERLINE(Code) | | Key for underline.
|
attributes | protected HashMap attributes(Code) | | Contains some of the attributes for this Chunk.
|
font | protected Font font(Code) | | This is the Font of this chunk of text.
|
Chunk | public Chunk()(Code) | | Empty constructor.
|
Chunk | public Chunk(Chunk ck)(Code) | | A Chunk copy constructor.
Parameters: ck - the Chunk to be copied |
Chunk | public Chunk(String content, Font font)(Code) | | Constructs a chunk of text with a certain content and a certain
Font .
Parameters: content - the content Parameters: font - the font |
Chunk | public Chunk(String content)(Code) | | Constructs a chunk of text with a certain content, without specifying a
Font .
Parameters: content - the content |
Chunk | public Chunk(char c, Font font)(Code) | | Constructs a chunk of text with a char and a certain Font .
Parameters: c - the content Parameters: font - the font |
Chunk | public Chunk(char c)(Code) | | Constructs a chunk of text with a char, without specifying a Font
.
Parameters: c - the content |
Chunk | public Chunk(Image image, float offsetX, float offsetY)(Code) | | Constructs a chunk containing an Image .
Parameters: image - the image Parameters: offsetX - the image offset in the x direction Parameters: offsetY - the image offset in the y direction |
Chunk | public Chunk(Image image, float offsetX, float offsetY, boolean changeLeading)(Code) | | Constructs a chunk containing an Image .
Parameters: image - the image Parameters: offsetX - the image offset in the x direction Parameters: offsetY - the image offset in the y direction Parameters: changeLeading - true if the leading has to be adapted to the image |
Chunk | public Chunk(java.util.Properties attributes)(Code) | | Returns a Chunk that has been constructed taking in
account the value of some attributes .
Parameters: attributes - Some attributes |
append | public StringBuffer append(String string)(Code) | | appends some text to this Chunk .
Parameters: string - String a StringBuffer |
getAttributes | public HashMap getAttributes()(Code) | | Gets the attributes for this Chunk .
It may be null.
the attributes for this Chunk |
getChunks | public ArrayList getChunks()(Code) | | Gets all the chunks in this element.
an ArrayList |
getContent | public String getContent()(Code) | | Returns the content of this Chunk .
a String |
getFont | public Font getFont()(Code) | | Gets the font of this Chunk .
a Font |
getHorizontalScaling | public float getHorizontalScaling()(Code) | | Gets the horizontal scaling.
a percentage in float |
getImage | public Image getImage()(Code) | | Returns the image.
the image |
getTextRise | public float getTextRise()(Code) | | Gets the text displacement relatiev to the baseline.
a displacement in points |
getWidthPoint | public float getWidthPoint()(Code) | | Gets the width of the Chunk in points.
a width in points |
hasAttributes | public boolean hasAttributes()(Code) | | Checks the attributes of this Chunk .
false if there aren't any. |
isEmpty | public boolean isEmpty()(Code) | | Checks is this Chunk is empty.
false if the Chunk contains other characters thanspace. |
process | public boolean process(ElementListener listener)(Code) | | Processes the element by adding it (or the different parts) to an
ElementListener .
Parameters: listener - an ElementListener true if the element was processed successfully |
setAction | public Chunk setAction(PdfAction action)(Code) | | Sets an action for this Chunk .
Parameters: action - the action this Chunk |
setAnchor | public Chunk setAnchor(URL url)(Code) | | Sets an anchor for this Chunk .
Parameters: url - the URL to link to this Chunk |
setAnchor | public Chunk setAnchor(String url)(Code) | | Sets an anchor for this Chunk .
Parameters: url - the url to link to this Chunk |
setAnnotation | public Chunk setAnnotation(PdfAnnotation annotation)(Code) | | Sets a generic annotation to this Chunk .
Parameters: annotation - the annotation this Chunk |
setAttributes | public void setAttributes(HashMap attributes)(Code) | | Sets the attributes all at once.
Parameters: attributes - the attributes of a Chunk |
setBackground | public Chunk setBackground(Color color)(Code) | | Sets the color of the background Chunk .
Parameters: color - the color of the background this Chunk |
setBackground | public Chunk setBackground(Color color, float extraLeft, float extraBottom, float extraRight, float extraTop)(Code) | | Sets the color and the size of the background Chunk .
Parameters: color - the color of the background Parameters: extraLeft - increase the size of the rectangle in the left Parameters: extraBottom - increase the size of the rectangle in the bottom Parameters: extraRight - increase the size of the rectangle in the right Parameters: extraTop - increase the size of the rectangle in the top this Chunk |
setFont | public void setFont(Font font)(Code) | | Sets the font of this Chunk .
Parameters: font - a Font |
setGenericTag | public Chunk setGenericTag(String text)(Code) | | Sets the generic tag Chunk .
The text for this tag can be retrieved with PdfPageEvent .
Parameters: text - the text for the tag this Chunk |
setHorizontalScaling | public Chunk setHorizontalScaling(float scale)(Code) | | Sets the text horizontal scaling. A value of 1 is normal and a value of
0.5f shrinks the text to half it's width.
Parameters: scale - the horizontal scaling factor this Chunk |
setHyphenation | public Chunk setHyphenation(HyphenationEvent hyphenation)(Code) | | sets the hyphenation engine to this Chunk .
Parameters: hyphenation - the hyphenation engine this Chunk |
setLocalDestination | public Chunk setLocalDestination(String name)(Code) | | Sets a local destination for this Chunk .
Parameters: name - the name for this destination this Chunk |
setLocalGoto | public Chunk setLocalGoto(String name)(Code) | | Sets a local goto for this Chunk .
There must be a local destination matching the name.
Parameters: name - the name of the destination to go to this Chunk |
setNewPage | public Chunk setNewPage()(Code) | | Sets a new page tag..
this Chunk |
setRemoteGoto | public Chunk setRemoteGoto(String filename, String name)(Code) | | Sets a goto for a remote destination for this Chunk .
Parameters: filename - the file name of the destination document Parameters: name - the name of the destination to go to this Chunk |
setRemoteGoto | public Chunk setRemoteGoto(String filename, int page)(Code) | | Sets a goto for a remote destination for this Chunk .
Parameters: filename - the file name of the destination document Parameters: page - the page of the destination to go to. First page is 1 this Chunk |
setSkew | public Chunk setSkew(float alpha, float beta)(Code) | | Skews the text to simulate italic and other effects. Try alpha=0
and beta=12 .
Parameters: alpha - the first angle in degrees Parameters: beta - the second angle in degrees this Chunk |
setSplitCharacter | public Chunk setSplitCharacter(SplitCharacter splitCharacter)(Code) | | Sets the split characters.
Parameters: splitCharacter - the SplitCharacter interface this Chunk |
setTextRenderMode | public Chunk setTextRenderMode(int mode, float strokeWidth, Color strokeColor)(Code) | | Sets the text rendering mode. It can outline text, simulate bold and make
text invisible.
Parameters: mode - the text rendering mode. It can be PdfContentByte.TEXT_RENDER_MODE_FILL ,PdfContentByte.TEXT_RENDER_MODE_STROKE ,PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE and PdfContentByte.TEXT_RENDER_MODE_INVISIBLE . Parameters: strokeWidth - the stroke line width for the modes PdfContentByte.TEXT_RENDER_MODE_STROKE and PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE . Parameters: strokeColor - the stroke color or null to follow the textcolor this Chunk |
setTextRise | public Chunk setTextRise(float rise)(Code) | | Sets the text displacement relative to the baseline. Positive values rise
the text, negative values lower the text.
It can be used to implement sub/superscript.
Parameters: rise - the displacement in points this Chunk |
setUnderline | public Chunk setUnderline(float thickness, float yPosition)(Code) | | Sets an horizontal line that can be an underline or a strikethrough.
Actually, the line can be anywhere vertically and has always the
Chunk width. Multiple call to this method will produce multiple
lines.
Parameters: thickness - the absolute thickness of the line Parameters: yPosition - the absolute y position relative to the baseline this Chunk |
setUnderline | public Chunk setUnderline(Color color, float thickness, float thicknessMul, float yPosition, float yPositionMul, int cap)(Code) | | Sets an horizontal line that can be an underline or a strikethrough.
Actually, the line can be anywhere vertically and has always the
Chunk width. Multiple call to this method will produce multiple
lines.
Parameters: color - the color of the line or null to follow thetext color Parameters: thickness - the absolute thickness of the line Parameters: thicknessMul - the thickness multiplication factor with the font size Parameters: yPosition - the absolute y position relative to the baseline Parameters: yPositionMul - the position multiplication factor with the font size Parameters: cap - the end line cap. Allowed values arePdfContentByte.LINE_CAP_BUTT, PdfContentByte.LINE_CAP_ROUNDand PdfContentByte.LINE_CAP_PROJECTING_SQUARE this Chunk |
toString | public String toString()(Code) | | Returns the content of this Chunk .
a String |
type | public int type()(Code) | | Gets the type of the text element.
a type |
|
|