Chunk Public class
Description
This is the smallest significant part of text that can be added to a document.
Diagram
flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text iTextSharp.text.Chunk[[Chunk]] iTextSharp.text.IElement[[IElement]] class iTextSharp.text.IElement interfaceStyle; end subgraph iTextSharp.text.pdf.interfaces iTextSharp.text.pdf.interfaces.IAccessibleElement[[IAccessibleElement]] class iTextSharp.text.pdf.interfaces.IAccessibleElement interfaceStyle; end iTextSharp.text.IElement --> iTextSharp.text.Chunk iTextSharp.text.pdf.interfaces.IAccessibleElement --> iTextSharp.text.Chunk
Members
Properties
Public properties
|
Type |
Name |
Methods |
|---|---|---|
|
|
|
|
|
> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Methods
Public methods
|
Returns |
Name |
|---|---|
|
|
( |
|
|
(
key) |
|
,
> |
() |
|
|
() |
|
|
() |
|
|
()
|
|
|
() |
|
|
() |
|
|
() |
|
|
() |
|
|
() |
|
|
()
|
|
|
() |
|
|
()
|
|
|
() |
|
|
() |
|
|
() |
|
|
(
listener)
|
|
|
(
key,
value) |
|
|
(
action)
|
|
|
( |
|
|
(
annotation)
|
|
|
( |
|
|
( |
|
|
( |
|
|
( |
|
|
(
hyphenation)
|
|
|
( |
|
|
( |
|
|
()
|
|
|
( |
|
|
( |
|
|
(
splitCharacter)
|
|
|
( |
|
|
(
strokeColor) |
|
|
( |
|
|
( |
|
|
( |
|
|
() |
|
|
( |
Public Static methods
|
Returns |
Name |
|---|---|
|
|
( |
|
|
( |
Details
Summary
This is the smallest significant part of text that can be added to a document.
Remarks
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.
Example
Chunk chunk = new Chunk("Hello world", FontFactory.GetFont(FontFactory.COURIER, 20, Font.ITALIC, new BaseColor(255, 0, 0))); document.Add(chunk);
Inheritance
Constructors
Chunk [1/12]
Source code
public Chunk()
Summary
Empty constructor.
Chunk [2/12]
Source code
public Chunk(Chunk ck)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
ck |
Chunk [3/12]
Source code
public Chunk(string content, Font font)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
content |
the content |
|
|
font |
the font |
Summary
Constructs a chunk of text with a certain content and a certain Font.
Chunk [4/12]
Source code
public Chunk(string content)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
content |
the content |
Summary
Constructs a chunk of text with a certain content, without specifying a Font.
Chunk [5/12]
Source code
public Chunk(char c, Font font)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
c |
|
|
|
font |
Chunk [6/12]
Source code
public Chunk(char c)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
c |
Chunk [7/12]
Source code
public Chunk(Image image, float offsetX, float offsetY)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
image |
the image |
|
|
offsetX |
the image offset in the x direction |
|
|
offsetY |
the image offset in the y direction |
Summary
Constructs a chunk containing an Image.
Chunk [8/12]
Source code
public Chunk(IDrawInterface separator)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
separator |
Chunk [9/12]
Source code
public Chunk(IDrawInterface separator, bool vertical)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
separator |
|
|
|
vertical |
Chunk [10/12]
Source code
public Chunk(IDrawInterface separator, float tabPosition)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
separator |
|
|
|
tabPosition |
Chunk [11/12]
Source code
public Chunk(IDrawInterface separator, float tabPosition, bool newline)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
separator |
|
|
|
tabPosition |
|
|
|
newline |
Chunk [12/12]
Source code
public Chunk(Image image, float offsetX, float offsetY, bool changeLeading)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
image |
the image |
|
|
offsetX |
the image offset in the x direction |
|
|
offsetY |
the image offset in the y direction |
|
|
changeLeading |
true if the leading has to be adapted to the image |
Summary
Constructs a chunk containing an Image.
Methods
Process
Source code
public virtual bool Process(IElementListener listener)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
listener |
an IElementListener |
Summary
Processes the element by adding it (or the different parts) to an IElementListener.
Returns
true if the element was processed successfully
Append
Source code
public virtual StringBuilder Append(string str)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
str |
a string |
Summary
appends some text to this Chunk.
Returns
a StringBuilder
ToString
Source code
public override string ToString()
IsEmpty
Source code
public virtual bool IsEmpty()
Summary
Checks is this Chunk is empty.
Returns
false if the Chunk contains other characters than space.
GetWidthPoint
Source code
public virtual float GetWidthPoint()
HasAttributes
Source code
public virtual bool HasAttributes()
Summary
Checks the attributes of this Chunk.
Returns
false if there aren't any.
HasAccessibleAttributes
Source code
public bool HasAccessibleAttributes()
SetHorizontalScaling
Source code
public virtual Chunk SetHorizontalScaling(float scale)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
scale |
SetUnderline [1/2]
Source code
public virtual Chunk SetUnderline(float thickness, float yPosition)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
thickness |
|
|
|
yPosition |
SetUnderline [2/2]
Source code
public virtual Chunk SetUnderline(BaseColor color, float thickness, float thicknessMul, float yPosition, float yPositionMul, int cap)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
color |
|
|
|
thickness |
|
|
|
thicknessMul |
|
|
|
yPosition |
|
|
|
yPositionMul |
|
|
|
cap |
SetTextRise
Source code
public virtual Chunk SetTextRise(float rise)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
rise |
the displacement in points |
Summary
Sets the text displacement relative to the baseline. Positive values rise the text, negative values lower the text.
Remarks
It can be used to implement sub/basescript.
Returns
this Chunk
GetTextRise
Source code
public virtual float GetTextRise()
SetSkew
Source code
public virtual Chunk SetSkew(float alpha, float beta)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
alpha |
|
|
|
beta |
SetBackground [1/2]
Source code
public virtual Chunk SetBackground(BaseColor color)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
color |
the color of the background |
Summary
Sets the color of the background Chunk.
Returns
this Chunk
SetBackground [2/2]
Source code
public virtual Chunk SetBackground(BaseColor color, float extraLeft, float extraBottom, float extraRight, float extraTop)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
color |
|
|
|
extraLeft |
|
|
|
extraBottom |
|
|
|
extraRight |
|
|
|
extraTop |
SetTextRenderMode
Source code
public virtual Chunk SetTextRenderMode(int mode, float strokeWidth, BaseColor strokeColor)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
mode |
|
|
|
strokeWidth |
|
|
|
strokeColor |
SetSplitCharacter
Source code
public virtual Chunk SetSplitCharacter(ISplitCharacter splitCharacter)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
splitCharacter |
the SplitCharacter interface |
Summary
Sets the split characters.
Returns
this Chunk
SetHyphenation
Source code
public virtual Chunk SetHyphenation(IHyphenationEvent hyphenation)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
hyphenation |
the hyphenation engine |
Summary
sets the hyphenation engine to this Chunk.
Returns
this Chunk
SetRemoteGoto [1/2]
Source code
public virtual Chunk SetRemoteGoto(string filename, string name)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
filename |
the file name of the destination document |
|
|
name |
the name of the destination to go to |
Summary
Sets a goto for a remote destination for this Chunk.
Returns
this Chunk
SetRemoteGoto [2/2]
Source code
public virtual Chunk SetRemoteGoto(string filename, int page)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
filename |
the file name of the destination document |
|
|
page |
the page of the destination to go to. First page is 1 |
Summary
Sets a goto for a remote destination for this Chunk.
Returns
this Chunk
SetLocalGoto
Source code
public virtual Chunk SetLocalGoto(string name)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
name |
the name of the destination to go to |
Summary
Sets a local goto for this Chunk.
Remarks
There must be a local destination matching the name.
Returns
this Chunk
SetLocalDestination
Source code
public virtual Chunk SetLocalDestination(string name)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
name |
the name for this destination |
Summary
Sets a local destination for this Chunk.
Returns
this Chunk
SetGenericTag
Source code
public virtual Chunk SetGenericTag(string text)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
text |
the text for the tag |
Summary
Sets the generic tag Chunk.
Remarks
The text for this tag can be retrieved with PdfPageEvent.
Returns
this Chunk
setLineHeight
Source code
public virtual Chunk setLineHeight(float lineheight)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
lineheight |
GetImage
Source code
public virtual Image GetImage()
Summary
Returns the image.
SetAction
Source code
public virtual Chunk SetAction(PdfAction action)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
action |
the action |
Summary
Sets an action for this Chunk.
Returns
this Chunk
SetAnchor [1/2]
Source code
public virtual Chunk SetAnchor(Uri url)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
url |
the Uri to link to |
Summary
Sets an anchor for this Chunk.
Returns
this Chunk
SetAnchor [2/2]
Source code
public virtual Chunk SetAnchor(string url)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
url |
the url to link to |
Summary
Sets an anchor for this Chunk.
Returns
this Chunk
SetNewPage
Source code
public virtual Chunk SetNewPage()
Summary
Sets a new page tag.
Returns
this Chunk
SetAnnotation
Source code
public virtual Chunk SetAnnotation(PdfAnnotation annotation)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
annotation |
the annotation |
Summary
Sets a generic annotation to this Chunk.
Returns
this Chunk
IsContent
Source code
public virtual bool IsContent()
IsNestable
Source code
public virtual bool IsNestable()
GetHyphenation
Source code
public virtual IHyphenationEvent GetHyphenation()
SetCharacterSpacing
Source code
public virtual Chunk SetCharacterSpacing(float charSpace)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
charSpace |
GetCharacterSpacing
Source code
public virtual float GetCharacterSpacing()
SetWordSpacing
Source code
public virtual Chunk SetWordSpacing(float wordSpace)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
wordSpace |
GetWordSpacing
Source code
public virtual float GetWordSpacing()
CreateWhitespace [1/2]
Source code
public static Chunk CreateWhitespace(string content)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
content |
CreateWhitespace [2/2]
Source code
public static Chunk CreateWhitespace(string content, bool preserve)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
content |
|
|
|
preserve |
IsWhitespace
Source code
public virtual bool IsWhitespace()
CreateTabspace [1/2]
Source code
public static Chunk CreateTabspace()
CreateTabspace [2/2]
Source code
public static Chunk CreateTabspace(float spacing)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
spacing |
IsTabspace
Source code
public virtual bool IsTabspace()
GetAccessibleAttribute
Source code
public virtual PdfObject GetAccessibleAttribute(PdfName key)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
key |
SetAccessibleAttribute
Source code
public virtual void SetAccessibleAttribute(PdfName key, PdfObject value)
Arguments
GetAccessibleAttributes
Source code
public virtual Dictionary<PdfName, PdfObject> GetAccessibleAttributes()
GetTextExpansion
Source code
public virtual string GetTextExpansion()
SetTextExpansion
Source code
public virtual void SetTextExpansion(string value)
Arguments
|
Type |
Name |
Description |
|---|---|---|
|
|
value |
Properties
Type
public virtual int Type { get; }
Summary
Gets the type of the text element.
Value
a type
Chunks
public virtual IList<Chunk> Chunks { get; }
Summary
Gets all the chunks in this element.
Value
an ArrayList
Font
public virtual Font Font { get; set; }
Summary
Get/set the font of this Chunk.
Value
a Font
Content
public virtual string Content { get; }
Summary
Returns the content of this Chunk.
Value
a string
Attributes
public virtual Dictionary<string, object> Attributes { get; set; }
Summary
Sets/Gets the attributes for this Chunk.
Remarks
It may be null.
Value
a Hashtable
HorizontalScaling
public virtual float HorizontalScaling { get; }
Role
public virtual PdfName Role { get; set; }
ID
public virtual AccessibleElementId ID { get; set; }
IsInline
public virtual bool IsInline { get; }
Generated with ModularDoc