Package com.itextpdf.text
Class Chunk
- java.lang.Object
-
- com.itextpdf.text.Chunk
-
- All Implemented Interfaces:
Element
,IAccessibleElement
- Direct Known Subclasses:
TabbedChunk
public class Chunk extends java.lang.Object implements Element, IAccessibleElement
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 aString
with a certainFont
. 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 BaseColor(255, 0, 0))); document.add(chunk);
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.HashMap<PdfName,PdfObject>
accessibleAttributes
static java.lang.String
ACTION
Key for Action.protected java.util.HashMap<java.lang.String,java.lang.Object>
attributes
Contains some of the attributes for this Chunk.static java.lang.String
BACKGROUND
Key for background.static java.lang.String
CHAR_SPACING
Key for character spacing.static java.lang.String
COLOR
Key for color.protected java.lang.StringBuffer
content
This is the content of this chunk of text.private java.lang.String
contentWithNoTabs
static java.lang.String
ENCODING
Key for encoding.protected Font
font
This is theFont
of this chunk of text.static java.lang.String
GENERICTAG
Key for generic tag.static java.lang.String
HSCALE
Key for text horizontal scaling.static java.lang.String
HYPHENATION
Key for hyphenation.private AccessibleElementId
id
static java.lang.String
IMAGE
Key for image.static java.lang.String
LINEHEIGHT
Key for line-height (alternative for leading in Phrase).static java.lang.String
LOCALDESTINATION
Key for local destination.static java.lang.String
LOCALGOTO
Key for local goto.static Chunk
NEWLINE
This is a Chunk containing a newline.static java.lang.String
NEWPAGE
Key for newpage.static Chunk
NEXTPAGE
This is a Chunk containing a newpage.static java.lang.String
OBJECT_REPLACEMENT_CHARACTER
The character stand in for an image or a separator.static java.lang.String
PDFANNOTATION
Key for annotation.static java.lang.String
REMOTEGOTO
Key for remote goto.protected PdfName
role
static java.lang.String
SEPARATOR
Key for drawInterface of the Separator.static java.lang.String
SKEW
Key for text skewing.static Chunk
SPACETABBING
static java.lang.String
SPLITCHARACTER
Key for split character.static java.lang.String
SUBSUPSCRIPT
Key for sub/superscript.static java.lang.String
TAB
Key for drawInterface of the tab.static Chunk
TABBING
static java.lang.String
TABSETTINGS
Key for tab stops of the tab.static java.lang.String
TEXTRENDERMODE
Key for text rendering mode.static java.lang.String
UNDERLINE
Key for underline.static java.lang.String
WHITESPACE
static java.lang.String
WORD_SPACING
Key for word spacing.-
Fields inherited from interface com.itextpdf.text.Element
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, BODY, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CHAPTER, CHUNK, CREATIONDATE, CREATOR, DIV, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LANGUAGE, LIST, LISTITEM, MARKED, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, SECTION, SUBJECT, TITLE, WRITABLE_DIRECT, YMARK
-
-
Constructor Summary
Constructors Modifier Constructor Description Chunk()
Empty constructor.Chunk(char c)
Constructs a chunk of text with a char, without specifying aFont
.Chunk(char c, Font font)
Constructs a chunk of text with a char and a certainFont
.Chunk(Chunk ck)
AChunk
copy constructor.Chunk(Image image, float offsetX, float offsetY)
Constructs a chunk containing anImage
.Chunk(Image image, float offsetX, float offsetY, boolean changeLeading)
Constructs a chunk containing anImage
.Chunk(DrawInterface separator)
Creates a separator Chunk.Chunk(DrawInterface separator, boolean vertical)
Creates a separator Chunk.Chunk(DrawInterface separator, float tabPosition)
Deprecated.Chunk(DrawInterface separator, float tabPosition, boolean newline)
Deprecated.private
Chunk(java.lang.Float tabInterval, boolean isWhitespace)
Creates a tab Chunk.Chunk(java.lang.String content)
Constructs a chunk of text with a certain content, without specifying aFont
.Chunk(java.lang.String content, Font font)
Constructs a chunk of text with a certain content and a certainFont
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.StringBuffer
append(java.lang.String string)
appends some text to thisChunk
.static Chunk
createTabspace()
Deprecated.static Chunk
createTabspace(float spacing)
Deprecated.static Chunk
createWhitespace(java.lang.String content)
static Chunk
createWhitespace(java.lang.String content, boolean preserve)
PdfObject
getAccessibleAttribute(PdfName key)
Get the attribute of accessible element (everything inA
dictionary +Lang
,Alt
,ActualText
,E
).java.util.HashMap<PdfName,PdfObject>
getAccessibleAttributes()
Gets all the properties of accessible element.java.util.HashMap<java.lang.String,java.lang.Object>
getAttributes()
Gets the attributes for thisChunk
.float
getCharacterSpacing()
Gets the character spacing.java.util.List<Chunk>
getChunks()
Gets all the chunks in this element.java.lang.String
getContent()
Returns the content of thisChunk
.Font
getFont()
Gets the font of thisChunk
.float
getHorizontalScaling()
Gets the horizontal scaling.HyphenationEvent
getHyphenation()
Returns the hyphenation (if present).AccessibleElementId
getId()
Image
getImage()
Returns the image.PdfName
getRole()
Gets the role of the accessible element.java.lang.String
getTextExpansion()
float
getTextRise()
Gets the text displacement relative to the baseline.float
getWidthPoint()
Gets the width of the Chunk in points.float
getWordSpacing()
Gets the word spacing.boolean
hasAccessibleAttributes()
Checks the accessible attributes of thisChunk
.boolean
hasAttributes()
Checks the attributes of thisChunk
.boolean
isContent()
Checks if this element is a content object.boolean
isEmpty()
Checks is thisChunk
is empty.boolean
isInline()
boolean
isNestable()
Checks if this element is nestable.boolean
isTabspace()
Deprecated.boolean
isWhitespace()
boolean
process(ElementListener listener)
Processes the element by adding it (or the different parts) to anElementListener
.void
setAccessibleAttribute(PdfName key, PdfObject value)
Set the attribute of accessible element (everything inA
dictionary +Lang
,Alt
,ActualText
,E
).Chunk
setAction(PdfAction action)
Sets an action for thisChunk
.Chunk
setAnchor(java.lang.String url)
Sets an anchor for thisChunk
.Chunk
setAnchor(java.net.URL url)
Sets an anchor for thisChunk
.Chunk
setAnnotation(PdfAnnotation annotation)
Sets a generic annotation to thisChunk
.private Chunk
setAttribute(java.lang.String name, java.lang.Object obj)
Sets an arbitrary attribute.void
setAttributes(java.util.HashMap<java.lang.String,java.lang.Object> attributes)
Sets the attributes all at once.Chunk
setBackground(BaseColor color)
Sets the color of the backgroundChunk
.Chunk
setBackground(BaseColor color, float extraLeft, float extraBottom, float extraRight, float extraTop)
Sets the color and the size of the backgroundChunk
.Chunk
setCharacterSpacing(float charSpace)
Sets the character spacing.void
setFont(Font font)
Sets the font of thisChunk
.Chunk
setGenericTag(java.lang.String text)
Sets the generic tagChunk
.Chunk
setHorizontalScaling(float scale)
Sets the text horizontal scaling.Chunk
setHyphenation(HyphenationEvent hyphenation)
sets the hyphenation engine to thisChunk
.void
setId(AccessibleElementId id)
Chunk
setLineHeight(float lineheight)
Sets a line height tag.Chunk
setLocalDestination(java.lang.String name)
Sets a local destination for thisChunk
.Chunk
setLocalGoto(java.lang.String name)
Sets a local goto for thisChunk
.Chunk
setNewPage()
Sets a new page tag..Chunk
setRemoteGoto(java.lang.String filename, int page)
Sets a goto for a remote destination for thisChunk
.Chunk
setRemoteGoto(java.lang.String filename, java.lang.String name)
Sets a goto for a remote destination for thisChunk
.void
setRole(PdfName role)
Sets the role of the accessiblee element.Chunk
setSkew(float alpha, float beta)
Skews the text to simulate italic and other effects.Chunk
setSplitCharacter(SplitCharacter splitCharacter)
Sets the split characters.void
setTextExpansion(java.lang.String value)
Sets the textual expansion of the abbreviation or acronym.Chunk
setTextRenderMode(int mode, float strokeWidth, BaseColor strokeColor)
Sets the text rendering mode.Chunk
setTextRise(float rise)
Sets the text displacement relative to the baseline.Chunk
setUnderline(float thickness, float yPosition)
Sets an horizontal line that can be an underline or a strikethrough.Chunk
setUnderline(BaseColor color, float thickness, float thicknessMul, float yPosition, float yPositionMul, int cap)
Sets an horizontal line that can be an underline or a strikethrough.Chunk
setWordSpacing(float wordSpace)
Sets the word spacing.java.lang.String
toString()
Returns the content of thisChunk
.int
type()
Gets the type of the text element.
-
-
-
Field Detail
-
OBJECT_REPLACEMENT_CHARACTER
public static final java.lang.String OBJECT_REPLACEMENT_CHARACTER
The character stand in for an image or a separator.- See Also:
- Constant Field Values
-
NEWLINE
public static final Chunk NEWLINE
This is a Chunk containing a newline.
-
NEXTPAGE
public static final Chunk NEXTPAGE
This is a Chunk containing a newpage.
-
TABBING
public static final Chunk TABBING
-
SPACETABBING
public static final Chunk SPACETABBING
-
content
protected java.lang.StringBuffer content
This is the content of this chunk of text.
-
font
protected Font font
This is theFont
of this chunk of text.
-
attributes
protected java.util.HashMap<java.lang.String,java.lang.Object> attributes
Contains some of the attributes for this Chunk.
-
role
protected PdfName role
-
id
private AccessibleElementId id
-
SEPARATOR
public static final java.lang.String SEPARATOR
Key for drawInterface of the Separator.- Since:
- 2.1.2
- See Also:
- Constant Field Values
-
TAB
public static final java.lang.String TAB
Key for drawInterface of the tab.- Since:
- 2.1.2
- See Also:
- Constant Field Values
-
TABSETTINGS
public static final java.lang.String TABSETTINGS
Key for tab stops of the tab.- Since:
- 5.4.1
- See Also:
- Constant Field Values
-
contentWithNoTabs
private java.lang.String contentWithNoTabs
-
HSCALE
public static final java.lang.String HSCALE
Key for text horizontal scaling.- See Also:
- Constant Field Values
-
UNDERLINE
public static final java.lang.String UNDERLINE
Key for underline.- See Also:
- Constant Field Values
-
SUBSUPSCRIPT
public static final java.lang.String SUBSUPSCRIPT
Key for sub/superscript.- See Also:
- Constant Field Values
-
SKEW
public static final java.lang.String SKEW
Key for text skewing.- See Also:
- Constant Field Values
-
BACKGROUND
public static final java.lang.String BACKGROUND
Key for background.- See Also:
- Constant Field Values
-
TEXTRENDERMODE
public static final java.lang.String TEXTRENDERMODE
Key for text rendering mode.- See Also:
- Constant Field Values
-
SPLITCHARACTER
public static final java.lang.String SPLITCHARACTER
Key for split character.- See Also:
- Constant Field Values
-
HYPHENATION
public static final java.lang.String HYPHENATION
Key for hyphenation.- See Also:
- Constant Field Values
-
REMOTEGOTO
public static final java.lang.String REMOTEGOTO
Key for remote goto.- See Also:
- Constant Field Values
-
LOCALGOTO
public static final java.lang.String LOCALGOTO
Key for local goto.- See Also:
- Constant Field Values
-
LOCALDESTINATION
public static final java.lang.String LOCALDESTINATION
Key for local destination.- See Also:
- Constant Field Values
-
GENERICTAG
public static final java.lang.String GENERICTAG
Key for generic tag.- See Also:
- Constant Field Values
-
LINEHEIGHT
public static final java.lang.String LINEHEIGHT
Key for line-height (alternative for leading in Phrase).- See Also:
- Constant Field Values
-
IMAGE
public static final java.lang.String IMAGE
Key for image.- See Also:
- Constant Field Values
-
ACTION
public static final java.lang.String ACTION
Key for Action.- See Also:
- Constant Field Values
-
NEWPAGE
public static final java.lang.String NEWPAGE
Key for newpage.- See Also:
- Constant Field Values
-
PDFANNOTATION
public static final java.lang.String PDFANNOTATION
Key for annotation.- See Also:
- Constant Field Values
-
COLOR
public static final java.lang.String COLOR
Key for color.- See Also:
- Constant Field Values
-
ENCODING
public static final java.lang.String ENCODING
Key for encoding.- See Also:
- Constant Field Values
-
CHAR_SPACING
public static final java.lang.String CHAR_SPACING
Key for character spacing.- See Also:
- Constant Field Values
-
WORD_SPACING
public static final java.lang.String WORD_SPACING
Key for word spacing.- See Also:
- Constant Field Values
-
WHITESPACE
public static final java.lang.String WHITESPACE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Chunk
public Chunk()
Empty constructor.
-
Chunk
public Chunk(Chunk ck)
AChunk
copy constructor.- Parameters:
ck
- theChunk
to be copied
-
Chunk
public Chunk(java.lang.String content, Font font)
Constructs a chunk of text with a certain content and a certainFont
.- Parameters:
content
- the contentfont
- the font
-
Chunk
public Chunk(java.lang.String content)
Constructs a chunk of text with a certain content, without specifying aFont
.- Parameters:
content
- the content
-
Chunk
public Chunk(char c, Font font)
Constructs a chunk of text with a char and a certainFont
.- Parameters:
c
- the contentfont
- the font
-
Chunk
public Chunk(char c)
Constructs a chunk of text with a char, without specifying aFont
.- Parameters:
c
- the content
-
Chunk
public Chunk(Image image, float offsetX, float offsetY)
Constructs a chunk containing anImage
.- Parameters:
image
- the imageoffsetX
- the image offset in the x directionoffsetY
- the image offset in the y direction
-
Chunk
public Chunk(DrawInterface separator)
Creates a separator Chunk. Note that separator chunks can't be used in combination with tab chunks!- Parameters:
separator
- the drawInterface to use to draw the separator.- Since:
- 2.1.2
-
Chunk
public Chunk(DrawInterface separator, boolean vertical)
Creates a separator Chunk. Note that separator chunks can't be used in combination with tab chunks!- Parameters:
separator
- the drawInterface to use to draw the separator.vertical
- true if this is a vertical separator- Since:
- 2.1.2
-
Chunk
@Deprecated public Chunk(DrawInterface separator, float tabPosition)
Deprecated.Creates a tab Chunk. Note that separator chunks can't be used in combination with tab chunks!- Parameters:
separator
- the drawInterface to use to draw the tab.tabPosition
- an X coordinate that will be used as start position for the next Chunk.- Since:
- 2.1.2
-
Chunk
@Deprecated public Chunk(DrawInterface separator, float tabPosition, boolean newline)
Deprecated.Creates a tab Chunk. Note that separator chunks can't be used in combination with tab chunks!- Parameters:
separator
- the drawInterface to use to draw the tab.tabPosition
- an X coordinate that will be used as start position for the next Chunk.newline
- if true, a newline will be added if the tabPosition has already been reached.- Since:
- 2.1.2
-
Chunk
private Chunk(java.lang.Float tabInterval, boolean isWhitespace)
Creates a tab Chunk.- Parameters:
tabInterval
- an interval that will be used if tab stops are omitted.isWhitespace
- if true, the current tab is treated as white space.- Since:
- 5.4.1
-
Chunk
public Chunk(Image image, float offsetX, float offsetY, boolean changeLeading)
Constructs a chunk containing anImage
.- Parameters:
image
- the imageoffsetX
- the image offset in the x directionoffsetY
- the image offset in the y directionchangeLeading
- true if the leading has to be adapted to the image
-
-
Method Detail
-
process
public boolean process(ElementListener listener)
Processes the element by adding it (or the different parts) to anElementListener
.
-
type
public int type()
Gets the type of the text element.
-
getChunks
public java.util.List<Chunk> getChunks()
Gets all the chunks in this element.
-
append
public java.lang.StringBuffer append(java.lang.String string)
appends some text to thisChunk
.- Parameters:
string
-String
- Returns:
- a
StringBuffer
-
setFont
public void setFont(Font font)
Sets the font of thisChunk
.- Parameters:
font
- aFont
-
getFont
public Font getFont()
Gets the font of thisChunk
.- Returns:
- a
Font
-
getContent
public java.lang.String getContent()
Returns the content of thisChunk
.- Returns:
- a
String
-
toString
public java.lang.String toString()
Returns the content of thisChunk
.
-
isEmpty
public boolean isEmpty()
Checks is thisChunk
is empty.- Returns:
false
if the Chunk contains other characters than space.
-
getWidthPoint
public float getWidthPoint()
Gets the width of the Chunk in points.- Returns:
- a width in points
-
hasAttributes
public boolean hasAttributes()
Checks the attributes of thisChunk
.- Returns:
- false if there aren't any.
-
hasAccessibleAttributes
public boolean hasAccessibleAttributes()
Checks the accessible attributes of thisChunk
.- Returns:
- false if there aren't any.
-
getAttributes
public java.util.HashMap<java.lang.String,java.lang.Object> getAttributes()
Gets the attributes for thisChunk
.It may be null.
- Returns:
- the attributes for this
Chunk
-
setAttributes
public void setAttributes(java.util.HashMap<java.lang.String,java.lang.Object> attributes)
Sets the attributes all at once.- Parameters:
attributes
- the attributes of a Chunk
-
setAttribute
private Chunk setAttribute(java.lang.String name, java.lang.Object obj)
Sets an arbitrary attribute.- Parameters:
name
- the key for the attributeobj
- the value of the attribute- Returns:
- this
Chunk
-
setHorizontalScaling
public Chunk setHorizontalScaling(float scale)
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- Returns:
- this
Chunk
-
getHorizontalScaling
public float getHorizontalScaling()
Gets the horizontal scaling.- Returns:
- a percentage in float
-
setUnderline
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 theChunk
width. Multiple call to this method will produce multiple lines.- Parameters:
thickness
- the absolute thickness of the lineyPosition
- the absolute y position relative to the baseline- Returns:
- this
Chunk
-
setUnderline
public Chunk setUnderline(BaseColor 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 theChunk
width. Multiple call to this method will produce multiple lines.- Parameters:
color
- the color of the line ornull
to follow the text colorthickness
- the absolute thickness of the linethicknessMul
- the thickness multiplication factor with the font sizeyPosition
- the absolute y position relative to the baselineyPositionMul
- the position multiplication factor with the font sizecap
- the end line cap. Allowed values are PdfContentByte.LINE_CAP_BUTT, PdfContentByte.LINE_CAP_ROUND and PdfContentByte.LINE_CAP_PROJECTING_SQUARE- Returns:
- this
Chunk
-
setTextRise
public Chunk setTextRise(float rise)
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- Returns:
- this
Chunk
-
getTextRise
public float getTextRise()
Gets the text displacement relative to the baseline.- Returns:
- a displacement in points
-
setSkew
public Chunk setSkew(float alpha, float beta)
Skews the text to simulate italic and other effects. Tryalpha=0
andbeta=12
.- Parameters:
alpha
- the first angle in degreesbeta
- the second angle in degrees- Returns:
- this
Chunk
-
setBackground
public Chunk setBackground(BaseColor color)
Sets the color of the backgroundChunk
.- Parameters:
color
- the color of the background- Returns:
- this
Chunk
-
setBackground
public Chunk setBackground(BaseColor color, float extraLeft, float extraBottom, float extraRight, float extraTop)
Sets the color and the size of the backgroundChunk
.- Parameters:
color
- the color of the backgroundextraLeft
- increase the size of the rectangle in the leftextraBottom
- increase the size of the rectangle in the bottomextraRight
- increase the size of the rectangle in the rightextraTop
- increase the size of the rectangle in the top- Returns:
- this
Chunk
-
setTextRenderMode
public Chunk setTextRenderMode(int mode, float strokeWidth, BaseColor strokeColor)
Sets the text rendering mode. It can outline text, simulate bold and make text invisible.- Parameters:
mode
- the text rendering mode. It can bePdfContentByte.TEXT_RENDER_MODE_FILL
,PdfContentByte.TEXT_RENDER_MODE_STROKE
,PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE
andPdfContentByte.TEXT_RENDER_MODE_INVISIBLE
.strokeWidth
- the stroke line width for the modesPdfContentByte.TEXT_RENDER_MODE_STROKE
andPdfContentByte.TEXT_RENDER_MODE_FILL_STROKE
.strokeColor
- the stroke color ornull
to follow the text color- Returns:
- this
Chunk
-
setSplitCharacter
public Chunk setSplitCharacter(SplitCharacter splitCharacter)
Sets the split characters.- Parameters:
splitCharacter
- theSplitCharacter
interface- Returns:
- this
Chunk
-
setHyphenation
public Chunk setHyphenation(HyphenationEvent hyphenation)
sets the hyphenation engine to thisChunk
.- Parameters:
hyphenation
- the hyphenation engine- Returns:
- this
Chunk
-
setRemoteGoto
public Chunk setRemoteGoto(java.lang.String filename, java.lang.String name)
Sets a goto for a remote destination for thisChunk
.- Parameters:
filename
- the file name of the destination documentname
- the name of the destination to go to- Returns:
- this
Chunk
-
setRemoteGoto
public Chunk setRemoteGoto(java.lang.String filename, int page)
Sets a goto for a remote destination for thisChunk
.- Parameters:
filename
- the file name of the destination documentpage
- the page of the destination to go to. First page is 1- Returns:
- this
Chunk
-
setLocalGoto
public Chunk setLocalGoto(java.lang.String name)
Sets a local goto for thisChunk
.There must be a local destination matching the name.
- Parameters:
name
- the name of the destination to go to- Returns:
- this
Chunk
-
setLocalDestination
public Chunk setLocalDestination(java.lang.String name)
Sets a local destination for thisChunk
.- Parameters:
name
- the name for this destination- Returns:
- this
Chunk
-
setGenericTag
public Chunk setGenericTag(java.lang.String text)
Sets the generic tagChunk
.The text for this tag can be retrieved with
PdfPageEvent
.- Parameters:
text
- the text for the tag- Returns:
- this
Chunk
-
setLineHeight
public Chunk setLineHeight(float lineheight)
Sets a line height tag.- Returns:
- this
Chunk
-
getImage
public Image getImage()
Returns the image.- Returns:
- the image
-
setAction
public Chunk setAction(PdfAction action)
Sets an action for thisChunk
.- Parameters:
action
- the action- Returns:
- this
Chunk
-
setAnchor
public Chunk setAnchor(java.net.URL url)
Sets an anchor for thisChunk
.- Parameters:
url
- theURL
to link to- Returns:
- this
Chunk
-
setAnchor
public Chunk setAnchor(java.lang.String url)
Sets an anchor for thisChunk
.- Parameters:
url
- the url to link to- Returns:
- this
Chunk
-
setNewPage
public Chunk setNewPage()
Sets a new page tag..- Returns:
- this
Chunk
-
setAnnotation
public Chunk setAnnotation(PdfAnnotation annotation)
Sets a generic annotation to thisChunk
.- Parameters:
annotation
- the annotation- Returns:
- this
Chunk
-
isContent
public boolean isContent()
Description copied from interface:Element
Checks if this element is a content object. If not, it's a metadata object.- Specified by:
isContent
in interfaceElement
- Returns:
- true if this is a 'content' element; false if this is a 'metadata' element
- Since:
- iText 2.0.8
- See Also:
Element.isContent()
-
isNestable
public boolean isNestable()
Description copied from interface:Element
Checks if this element is nestable.- Specified by:
isNestable
in interfaceElement
- Returns:
- true if this element can be nested inside other elements.
- Since:
- iText 2.0.8
- See Also:
Element.isNestable()
-
getHyphenation
public HyphenationEvent getHyphenation()
Returns the hyphenation (if present).- Returns:
- the HypenationEvent of this Chunk
- Since:
- 2.1.2
-
setCharacterSpacing
public Chunk setCharacterSpacing(float charSpace)
Sets the character spacing.- Parameters:
charSpace
- the character spacing value- Returns:
- this
Chunk
-
getCharacterSpacing
public float getCharacterSpacing()
Gets the character spacing.- Returns:
- a value in float
-
setWordSpacing
public Chunk setWordSpacing(float wordSpace)
Sets the word spacing.- Parameters:
wordSpace
- the word spacing value- Returns:
- this
Chunk
-
getWordSpacing
public float getWordSpacing()
Gets the word spacing.- Returns:
- a value in float
-
createWhitespace
public static Chunk createWhitespace(java.lang.String content)
-
createWhitespace
public static Chunk createWhitespace(java.lang.String content, boolean preserve)
-
isWhitespace
public boolean isWhitespace()
-
createTabspace
@Deprecated public static Chunk createTabspace()
Deprecated.
-
createTabspace
@Deprecated public static Chunk createTabspace(float spacing)
Deprecated.
-
isTabspace
@Deprecated public boolean isTabspace()
Deprecated.
-
getAccessibleAttribute
public PdfObject getAccessibleAttribute(PdfName key)
Description copied from interface:IAccessibleElement
Get the attribute of accessible element (everything inA
dictionary +Lang
,Alt
,ActualText
,E
).- Specified by:
getAccessibleAttribute
in interfaceIAccessibleElement
- Returns:
-
setAccessibleAttribute
public void setAccessibleAttribute(PdfName key, PdfObject value)
Description copied from interface:IAccessibleElement
Set the attribute of accessible element (everything inA
dictionary +Lang
,Alt
,ActualText
,E
).- Specified by:
setAccessibleAttribute
in interfaceIAccessibleElement
-
getAccessibleAttributes
public java.util.HashMap<PdfName,PdfObject> getAccessibleAttributes()
Description copied from interface:IAccessibleElement
Gets all the properties of accessible element.- Specified by:
getAccessibleAttributes
in interfaceIAccessibleElement
- Returns:
-
getRole
public PdfName getRole()
Description copied from interface:IAccessibleElement
Gets the role of the accessible element.- Specified by:
getRole
in interfaceIAccessibleElement
- Returns:
-
setRole
public void setRole(PdfName role)
Description copied from interface:IAccessibleElement
Sets the role of the accessiblee element. Set role tonull
if you don't want to tag this element. Note that all child elements won't also be tagged.- Specified by:
setRole
in interfaceIAccessibleElement
-
getId
public AccessibleElementId getId()
- Specified by:
getId
in interfaceIAccessibleElement
-
setId
public void setId(AccessibleElementId id)
- Specified by:
setId
in interfaceIAccessibleElement
-
isInline
public boolean isInline()
- Specified by:
isInline
in interfaceIAccessibleElement
-
getTextExpansion
public java.lang.String getTextExpansion()
-
setTextExpansion
public void setTextExpansion(java.lang.String value)
Sets the textual expansion of the abbreviation or acronym. It is highly recommend to set textuual expansion when generating PDF/UA documents.- Parameters:
value
-
-
-