HiraokaHyperTools.iTextSharp-LGPL  0.2.5
iTextSharp.text.Chunk Class Reference

This is the smallest significant part of text that can be added to a document. More...

Inheritance diagram for iTextSharp.text.Chunk:
iTextSharp.text.IElement iTextSharp.text.rtf.RtfAddableElement iTextSharp.text.rtf.field.RtfField iTextSharp.text.rtf.direct.RtfDirectContent iTextSharp.text.rtf.graphic.RtfShape iTextSharp.text.rtf.graphic.RtfShapePosition iTextSharp.text.rtf.graphic.RtfShapeProperty iTextSharp.text.rtf.text.RtfTab iTextSharp.text.rtf.text.RtfTabGroup iTextSharp.text.rtf.field.RtfAnchor iTextSharp.text.rtf.field.RtfPageNumber iTextSharp.text.rtf.field.RtfTOCEntry iTextSharp.text.rtf.field.RtfTableOfContents iTextSharp.text.rtf.field.RtfTotalPageNumber

Public Member Functions

 Chunk ()
 Empty constructor. More...
 
 Chunk (Chunk ck)
 
 Chunk (string content, Font font)
 Constructs a chunk of text with a certain content and a certain Font. More...
 
 Chunk (string content)
 Constructs a chunk of text with a certain content, without specifying a Font. More...
 
 Chunk (char c, Font font)
 
 Chunk (char c)
 
 Chunk (Image image, float offsetX, float offsetY)
 Constructs a chunk containing an Image. More...
 
 Chunk (IDrawInterface separator)
 
 Chunk (IDrawInterface separator, bool vertical)
 
 Chunk (IDrawInterface separator, float tabPosition)
 
 Chunk (IDrawInterface separator, float tabPosition, bool newline)
 
 Chunk (Image image, float offsetX, float offsetY, bool changeLeading)
 Constructs a chunk containing an Image. More...
 
bool Process (IElementListener listener)
 Processes the element by adding it (or the different parts) to an IElementListener. More...
 
StringBuilder Append (string str)
 appends some text to this Chunk. More...
 
override string ToString ()
 Gets the content of the text element. More...
 
virtual bool IsEmpty ()
 Checks is this Chunk is empty. More...
 
float GetWidthPoint ()
 
bool HasAttributes ()
 Checks the attributes of this Chunk. More...
 
Chunk SetHorizontalScaling (float scale)
 
Chunk SetUnderline (float thickness, float yPosition)
 
Chunk SetUnderline (Color color, float thickness, float thicknessMul, float yPosition, float yPositionMul, int cap)
 summary> Key for sub/basescript. More...
 
Chunk SetTextRise (float rise)
 Sets the text displacement relative to the baseline. Positive values rise the text, negative values lower the text. More...
 
float GetTextRise ()
 summary> Key for text skewing. More...
 
Chunk SetSkew (float alpha, float beta)
 summary> Key for background. More...
 
Chunk SetBackground (Color color)
 Sets the color of the background Chunk. More...
 
Chunk SetBackground (Color color, float extraLeft, float extraBottom, float extraRight, float extraTop)
 summary> Key for text rendering mode. More...
 
Chunk SetTextRenderMode (int mode, float strokeWidth, Color strokeColor)
 summary> Key for split character. More...
 
Chunk SetSplitCharacter (ISplitCharacter splitCharacter)
 Sets the split characters. More...
 
Chunk SetHyphenation (IHyphenationEvent hyphenation)
 sets the hyphenation engine to this Chunk. More...
 
Chunk SetRemoteGoto (string filename, string name)
 Sets a goto for a remote destination for this Chunk. More...
 
Chunk SetRemoteGoto (string filename, int page)
 Sets a goto for a remote destination for this Chunk. More...
 
Chunk SetLocalGoto (string name)
 Sets a local goto for this Chunk. More...
 
Chunk SetLocalDestination (string name)
 Sets a local destination for this Chunk. More...
 
Chunk SetGenericTag (string text)
 Sets the generic tag Chunk. More...
 
Image GetImage ()
 Returns the image. More...
 
Chunk SetAction (PdfAction action)
 Sets an action for this Chunk. More...
 
Chunk SetAnchor (Uri url)
 Sets an anchor for this Chunk. More...
 
Chunk SetAnchor (string url)
 Sets an anchor for this Chunk. More...
 
Chunk SetNewPage ()
 Sets a new page tag. More...
 
Chunk SetAnnotation (PdfAnnotation annotation)
 Sets a generic annotation to this Chunk. More...
 
bool IsContent ()
 
bool IsNestable ()
 
IHyphenationEvent GetHyphenation ()
 

Static Public Member Functions

static bool IsTag (string tag)
 Checks if a given tag corresponds with this object. More...
 

Static Public Attributes

const string OBJECT_REPLACEMENT_CHARACTER = "\ufffc"
 summary> This is a Chunk containing a newline. More...
 
static readonly Chunk NEWLINE = new Chunk("\n")
 
static readonly Chunk NEXTPAGE = new Chunk("")
 
const String SEPARATOR = "SEPARATOR"
 
const String TAB = "TAB"
 
const string HSCALE = "HSCALE"
 
const string UNDERLINE = "UNDERLINE"
 
const string SUBSUPSCRIPT = "SUBSUPSCRIPT"
 
const string SKEW = "SKEW"
 
const string BACKGROUND = "BACKGROUND"
 
const string TEXTRENDERMODE = "TEXTRENDERMODE"
 
const string SPLITCHARACTER = "SPLITCHARACTER"
 
const string HYPHENATION = "HYPHENATION"
 
const string REMOTEGOTO = "REMOTEGOTO"
 
const string LOCALGOTO = "LOCALGOTO"
 
const string LOCALDESTINATION = "LOCALDESTINATION"
 
const string GENERICTAG = "GENERICTAG"
 
const string IMAGE = "IMAGE"
 
const string ACTION = "ACTION"
 
const string NEWPAGE = "NEWPAGE"
 
const string PDFANNOTATION = "PDFANNOTATION"
 
const string COLOR = "COLOR"
 Key for color. More...
 
const string ENCODING = "ENCODING"
 

Protected Attributes

StringBuilder content = null
 This is the content of this chunk of text. More...
 
Font font = null
 summary> Contains some of the attributes for this Chunk. More...
 
Hashtable attributes = null
 

Properties

int Type [get]
 Gets the type of the text element. More...
 
ArrayList Chunks [get]
 Gets all the chunks in this element. More...
 
virtual Font Font [get, set]
 Get/set the font of this Chunk. More...
 
virtual string Content [get]
 Returns the content of this Chunk. More...
 
Hashtable Attributes [get, set]
 Gets the attributes for this Chunk. More...
 
float HorizontalScaling [get]
 summary> Key for underline. More...
 
- Properties inherited from iTextSharp.text.IElement
int Type [get]
 Gets the type of the text element. More...
 
ArrayList Chunks [get]
 Gets all the chunks in this element. More...
 

Detailed Description

This is the smallest significant part of text that can be added to a document.

Most elements can be divided in one or more Chunks. A chunk is a string with a certain Font. all other layoutparameters should be defined in the object to which this chunk of text is added.

<strong>Chunk chunk = new Chunk("Hello world", FontFactory.GetFont(FontFactory.COURIER, 20, Font.ITALIC, new Color(255, 0, 0)));</strong>
document.Add(chunk);
virtual Font Font
Get/set the font of this Chunk.
Definition: Chunk.cs:303
const int ITALIC
this is a possible style.
Definition: Font.cs:95

Constructor & Destructor Documentation

◆ Chunk() [1/12]

iTextSharp.text.Chunk.Chunk ( )

Empty constructor.

<overloads> Has six overloads. </overloads>

◆ Chunk() [2/12]

iTextSharp.text.Chunk.Chunk ( Chunk  ck)

A Chunk copy constructor.

Parameters
ckthe Chunk to be copied

◆ Chunk() [3/12]

iTextSharp.text.Chunk.Chunk ( string  content,
Font  font 
)

Constructs a chunk of text with a certain content and a certain Font.

Parameters
contentthe content
fontthe font

◆ Chunk() [4/12]

iTextSharp.text.Chunk.Chunk ( string  content)

Constructs a chunk of text with a certain content, without specifying a Font.

Parameters
contentthe content

◆ Chunk() [5/12]

iTextSharp.text.Chunk.Chunk ( char  c,
Font  font 
)

Constructs a chunk of text with a char and a certain Font.

Parameters
cthe content
fontthe font

◆ Chunk() [6/12]

iTextSharp.text.Chunk.Chunk ( char  c)

Constructs a chunk of text with a char, without specifying a Font.

Parameters
cthe content

◆ Chunk() [7/12]

iTextSharp.text.Chunk.Chunk ( Image  image,
float  offsetX,
float  offsetY 
)

Constructs a chunk containing an Image.

Parameters
imagethe image
offsetXthe image offset in the x direction
offsetYthe image offset in the y direction

◆ Chunk() [8/12]

iTextSharp.text.Chunk.Chunk ( IDrawInterface  separator)

Creates a separator Chunk. Note that separator chunks can't be used in combination with tab chunks!

Parameters
separatorthe drawInterface to use to draw the separator.
Since
2.1.2

◆ Chunk() [9/12]

iTextSharp.text.Chunk.Chunk ( IDrawInterface  separator,
bool  vertical 
)

Creates a separator Chunk. Note that separator chunks can't be used in combination with tab chunks!

Parameters
separatorthe drawInterface to use to draw the separator.
verticaltrue if this is a vertical separator
Since
2.1.2

◆ Chunk() [10/12]

iTextSharp.text.Chunk.Chunk ( IDrawInterface  separator,
float  tabPosition 
)

Creates a tab Chunk. Note that separator chunks can't be used in combination with tab chunks!

Parameters
separatorthe drawInterface to use to draw the tab.
tabPositionan X coordinate that will be used as start position for the next Chunk.
Since
2.1.2

◆ Chunk() [11/12]

iTextSharp.text.Chunk.Chunk ( IDrawInterface  separator,
float  tabPosition,
bool  newline 
)

Creates a tab Chunk. Note that separator chunks can't be used in combination with tab chunks!

Parameters
separatorthe drawInterface to use to draw the tab.
tabPositionan X coordinate that will be used as start position for the next Chunk.
newlineif true, a newline will be added if the tabPosition has already been reached.
Since
2.1.2

◆ Chunk() [12/12]

iTextSharp.text.Chunk.Chunk ( Image  image,
float  offsetX,
float  offsetY,
bool  changeLeading 
)

Constructs a chunk containing an Image.

Parameters
imagethe image
offsetXthe image offset in the x direction
offsetYthe image offset in the y direction
changeLeadingtrue if the leading has to be adapted to the image

Member Function Documentation

◆ Append()

StringBuilder iTextSharp.text.Chunk.Append ( string  str)

appends some text to this Chunk.

Parameters
stra string
Returns
a StringBuilder

◆ GetHyphenation()

IHyphenationEvent iTextSharp.text.Chunk.GetHyphenation ( )

Returns the hyphenation (if present).

Parameters
hyphenationa HyphenationEvent instance
Since
2.1.2

◆ GetImage()

Image iTextSharp.text.Chunk.GetImage ( )

Returns the image.

an Image

◆ GetTextRise()

float iTextSharp.text.Chunk.GetTextRise ( )

summary> Key for text skewing.

◆ GetWidthPoint()

float iTextSharp.text.Chunk.GetWidthPoint ( )

Gets the width of the Chunk in points.

Returns
a width in points

◆ HasAttributes()

bool iTextSharp.text.Chunk.HasAttributes ( )

Checks the attributes of this Chunk.

Returns
false if there aren't any.

◆ IsContent()

bool iTextSharp.text.Chunk.IsContent ( )
See also
com.lowagie.text.Element::isContent()
Since
iText 2.0.8

Implements iTextSharp.text.IElement.

◆ IsEmpty()

virtual bool iTextSharp.text.Chunk.IsEmpty ( )
virtual

Checks is this Chunk is empty.

Returns
false if the Chunk contains other characters than space.

Reimplemented in iTextSharp.text.rtf.RtfAddableElement, and iTextSharp.text.rtf.field.RtfField.

◆ IsNestable()

bool iTextSharp.text.Chunk.IsNestable ( )
See also
com.lowagie.text.Element::isNestable()
Since
iText 2.0.8

Implements iTextSharp.text.IElement.

◆ IsTag()

static bool iTextSharp.text.Chunk.IsTag ( string  tag)
static

Checks if a given tag corresponds with this object.

Parameters
tagthe given tag
Returns
true if the tag corresponds

summary> Key for Action.

◆ Process()

bool iTextSharp.text.Chunk.Process ( IElementListener  listener)

Processes the element by adding it (or the different parts) to an IElementListener.

Parameters
listeneran IElementListener
Returns
true if the element was processed successfully

Implements iTextSharp.text.IElement.

◆ SetAction()

Chunk iTextSharp.text.Chunk.SetAction ( PdfAction  action)

Sets an action for this Chunk.

Parameters
actionthe action
Returns
this Chunk

◆ SetAnchor() [1/2]

Chunk iTextSharp.text.Chunk.SetAnchor ( string  url)

Sets an anchor for this Chunk.

Parameters
urlthe url to link to
Returns
this Chunk

summary> Key for newpage.

◆ SetAnchor() [2/2]

Chunk iTextSharp.text.Chunk.SetAnchor ( Uri  url)

Sets an anchor for this Chunk.

Parameters
urlthe Uri to link to
Returns
this Chunk

◆ SetAnnotation()

Chunk iTextSharp.text.Chunk.SetAnnotation ( PdfAnnotation  annotation)

Sets a generic annotation to this Chunk.

Parameters
annotationthe annotation
Returns
this Chunk

◆ SetBackground() [1/2]

Chunk iTextSharp.text.Chunk.SetBackground ( Color  color)

Sets the color of the background Chunk.

Parameters
colorthe color of the background
Returns
this Chunk

◆ SetBackground() [2/2]

Chunk iTextSharp.text.Chunk.SetBackground ( Color  color,
float  extraLeft,
float  extraBottom,
float  extraRight,
float  extraTop 
)

summary> Key for text rendering mode.

Sets the color and the size of the background Chunk.

Parameters
colorthe color of the background
extraLeftincrease the size of the rectangle in the left
extraBottomincrease the size of the rectangle in the bottom
extraRightincrease the size of the rectangle in the right
extraTopincrease the size of the rectangle in the top
Returns
this Chunk

◆ SetGenericTag()

Chunk iTextSharp.text.Chunk.SetGenericTag ( string  text)

Sets the generic tag Chunk.

The text for this tag can be retrieved with PdfPageEvent.

Parameters
textthe text for the tag
Returns
this Chunk

summary> Key for image.

◆ SetHorizontalScaling()

Chunk iTextSharp.text.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
scalethe horizontal scaling factor
Returns
this Chunk

◆ SetHyphenation()

Chunk iTextSharp.text.Chunk.SetHyphenation ( IHyphenationEvent  hyphenation)

sets the hyphenation engine to this Chunk.

Parameters
hyphenationthe hyphenation engine
Returns
this Chunk

summary> Key for remote goto.

◆ SetLocalDestination()

Chunk iTextSharp.text.Chunk.SetLocalDestination ( string  name)

Sets a local destination for this Chunk.

Parameters
namethe name for this destination
Returns
this Chunk

summary> Key for generic tag.

◆ SetLocalGoto()

Chunk iTextSharp.text.Chunk.SetLocalGoto ( string  name)

Sets a local goto for this Chunk.

There must be a local destination matching the name.

Parameters
namethe name of the destination to go to
Returns
this Chunk

summary> Key for local destination.

◆ SetNewPage()

Chunk iTextSharp.text.Chunk.SetNewPage ( )

Sets a new page tag.

Returns
this Chunk

summary> Key for annotation.

◆ SetRemoteGoto() [1/2]

Chunk iTextSharp.text.Chunk.SetRemoteGoto ( string  filename,
int  page 
)

Sets a goto for a remote destination for this Chunk.

Parameters
filenamethe file name of the destination document
pagethe page of the destination to go to. First page is 1
Returns
this Chunk

summary> Key for local goto.

◆ SetRemoteGoto() [2/2]

Chunk iTextSharp.text.Chunk.SetRemoteGoto ( string  filename,
string  name 
)

Sets a goto for a remote destination for this Chunk.

Parameters
filenamethe file name of the destination document
namethe name of the destination to go to
Returns
this Chunk

◆ SetSkew()

Chunk iTextSharp.text.Chunk.SetSkew ( float  alpha,
float  beta 
)

summary> Key for background.

Skews the text to simulate italic and other effects. Try alpha=0 and beta=12.

Parameters
alphathe first angle in degrees
betathe second angle in degrees
Returns
this Chunk

◆ SetSplitCharacter()

Chunk iTextSharp.text.Chunk.SetSplitCharacter ( ISplitCharacter  splitCharacter)

Sets the split characters.

Parameters
splitCharacterthe SplitCharacter interface
Returns
this Chunk

summary> Key for hyphenation.

◆ SetTextRenderMode()

Chunk iTextSharp.text.Chunk.SetTextRenderMode ( int  mode,
float  strokeWidth,
Color  strokeColor 
)

summary> Key for split character.

Sets the text rendering mode. It can outline text, simulate bold and make text invisible.

Parameters
modethe 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.
strokeWidththe stroke line width for the modes PdfContentByte.TEXT_RENDER_MODE_STROKE and PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE.
strokeColorthe stroke color or null to follow the text color
Returns
this Chunk

◆ SetTextRise()

Chunk iTextSharp.text.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/basescript.

Parameters
risethe displacement in points
Returns
this Chunk

◆ SetUnderline() [1/2]

Chunk iTextSharp.text.Chunk.SetUnderline ( Color  color,
float  thickness,
float  thicknessMul,
float  yPosition,
float  yPositionMul,
int  cap 
)

summary> Key for sub/basescript.

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
colorthe color of the line or null to follow the text color
thicknessthe absolute thickness of the line
thicknessMulthe thickness multiplication factor with the font size
yPositionthe absolute y position relative to the baseline
yPositionMulthe position multiplication factor with the font size
capthe end line cap. Allowed values are PdfContentByte.LINE_CAP_BUTT, PdfContentByte.LINE_CAP_ROUND and PdfContentByte.LINE_CAP_PROJECTING_SQUARE
Returns
this Chunk

◆ SetUnderline() [2/2]

Chunk iTextSharp.text.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. Multiple call to this method will produce multiple lines.

Parameters
thicknessthe absolute thickness of the line
yPositionthe absolute y position relative to the baseline
Returns
this Chunk

◆ ToString()

override string iTextSharp.text.Chunk.ToString ( )

Gets the content of the text element.

Returns
the content of the text element

Implements iTextSharp.text.IElement.

Member Data Documentation

◆ ACTION

const string iTextSharp.text.Chunk.ACTION = "ACTION"
static

◆ attributes

Hashtable iTextSharp.text.Chunk.attributes = null
protected

◆ BACKGROUND

const string iTextSharp.text.Chunk.BACKGROUND = "BACKGROUND"
static

◆ COLOR

const string iTextSharp.text.Chunk.COLOR = "COLOR"
static

Key for color.

summary> Key for encoding.

◆ content

StringBuilder iTextSharp.text.Chunk.content = null
protected

This is the content of this chunk of text.

summary> This is the Font of this chunk of text.

◆ ENCODING

const string iTextSharp.text.Chunk.ENCODING = "ENCODING"
static

◆ font

Font iTextSharp.text.Chunk.font = null
protected

summary> Contains some of the attributes for this Chunk.

◆ GENERICTAG

const string iTextSharp.text.Chunk.GENERICTAG = "GENERICTAG"
static

◆ HSCALE

const string iTextSharp.text.Chunk.HSCALE = "HSCALE"
static

Key for text horizontal scaling.

◆ HYPHENATION

const string iTextSharp.text.Chunk.HYPHENATION = "HYPHENATION"
static

◆ IMAGE

const string iTextSharp.text.Chunk.IMAGE = "IMAGE"
static

◆ LOCALDESTINATION

const string iTextSharp.text.Chunk.LOCALDESTINATION = "LOCALDESTINATION"
static

◆ LOCALGOTO

const string iTextSharp.text.Chunk.LOCALGOTO = "LOCALGOTO"
static

◆ NEWLINE

readonly Chunk iTextSharp.text.Chunk.NEWLINE = new Chunk("\n")
static

◆ NEWPAGE

const string iTextSharp.text.Chunk.NEWPAGE = "NEWPAGE"
static

◆ NEXTPAGE

readonly Chunk iTextSharp.text.Chunk.NEXTPAGE = new Chunk("")
static

This is a Chunk containing a newpage.

◆ OBJECT_REPLACEMENT_CHARACTER

const string iTextSharp.text.Chunk.OBJECT_REPLACEMENT_CHARACTER = "\ufffc"
static

summary> This is a Chunk containing a newline.

The character stand in for an image or a separator.

◆ PDFANNOTATION

const string iTextSharp.text.Chunk.PDFANNOTATION = "PDFANNOTATION"
static

◆ REMOTEGOTO

const string iTextSharp.text.Chunk.REMOTEGOTO = "REMOTEGOTO"
static

◆ SEPARATOR

const String iTextSharp.text.Chunk.SEPARATOR = "SEPARATOR"
static

Key for drawInterface of the Separator.

Since
2.1.2

◆ SKEW

const string iTextSharp.text.Chunk.SKEW = "SKEW"
static

◆ SPLITCHARACTER

const string iTextSharp.text.Chunk.SPLITCHARACTER = "SPLITCHARACTER"
static

◆ SUBSUPSCRIPT

const string iTextSharp.text.Chunk.SUBSUPSCRIPT = "SUBSUPSCRIPT"
static

◆ TAB

const String iTextSharp.text.Chunk.TAB = "TAB"
static

Key for drawInterface of the tab.

Since
2.1.2

◆ TEXTRENDERMODE

const string iTextSharp.text.Chunk.TEXTRENDERMODE = "TEXTRENDERMODE"
static

◆ UNDERLINE

const string iTextSharp.text.Chunk.UNDERLINE = "UNDERLINE"
static

Property Documentation

◆ Attributes

Hashtable iTextSharp.text.Chunk.Attributes
getset

Gets the attributes for this Chunk.

It may be null.

a Hashtable

◆ Chunks

ArrayList iTextSharp.text.Chunk.Chunks
get

Gets all the chunks in this element.

an ArrayList

◆ Content

virtual string iTextSharp.text.Chunk.Content
get

Returns the content of this Chunk.

a string

◆ Font

virtual Font iTextSharp.text.Chunk.Font
getset

Get/set the font of this Chunk.

a Font

◆ HorizontalScaling

float iTextSharp.text.Chunk.HorizontalScaling
get

summary> Key for underline.

Gets the horizontal scaling.

Returns
a percentage in float

◆ Type

int iTextSharp.text.Chunk.Type
get

Gets the type of the text element.

a type


The documentation for this class was generated from the following file: