Table of Contents

Class MultiColumnText

Namespace
iTextSharp.text.pdf
Assembly
iTextSharp.LGPLv2.Core.dll

Formats content into one or more columns bounded by a rectangle. The columns may be simple rectangles or more complicated shapes. Add all of the columns before adding content. Column continuation is supported. A MultiColumnText object may be added to a document using Document.add . @author Steve Appling

public class MultiColumnText : IElement
Inheritance
MultiColumnText
Implements
Inherited Members

Constructors

MultiColumnText()

Default constructor. Sets height to AUTOMATIC . Columns will repeat on each page as necessary to accomodate content length.

public MultiColumnText()

MultiColumnText(float)

Construct a MultiColumnText container of the specified height. If height is AUTOMATIC , fill complete pages until done. If a specific height is used, it may span one or more pages.

public MultiColumnText(float height)

Parameters

height float

MultiColumnText(float, float)

Construct a MultiColumnText container of the specified height starting at the specified Y position.

public MultiColumnText(float top, float height)

Parameters

top float
height float

Fields

AUTOMATIC

special constant for automatic calculation of height

public const float AUTOMATIC = -1

Field Value

float

Properties

Alignment

Sets the default alignment

public int Alignment { set; }

Property Value

int

ArabicOptions

Sets the arabic shaping options. The option can be AR_NOVOWEL, AR_COMPOSEDTASHKEEL and AR_LIG.

public int ArabicOptions { set; }

Property Value

int

Chunks

Returns null - not used

public IList<Chunk> Chunks { get; }

Property Value

IList<Chunk>

null

CurrentColumn

Gets the current column.

public int CurrentColumn { get; }

Property Value

int

the current column

RunDirection

Sets the run direction.

public int RunDirection { set; }

Property Value

int

SpaceCharRatio

Sets the ratio between the extra word spacing and the extra character spacing when the text is fully justified. Extra word spacing will grow spaceCharRatio times more than extra character spacing. If the ratio is PdfWriter.NO_SPACE_CHAR_RATIO then the extra character spacing will be zero.

public float SpaceCharRatio { set; }

Property Value

float

Type

Gets the type of the text element.

public int Type { get; }

Property Value

int

a type

Methods

AddColumn(float[], float[])

Add a new column. The parameters are limits for each column wall in the format of a sequence of points (x1,y1,x2,y2,...).

public void AddColumn(float[] left, float[] right)

Parameters

left float[]

limits for left column

right float[]

limits for right column

AddElement(IElement)

Add an element to be rendered in a column. Note that you can only add a Phrase or a Chunk if the columns are not all simple. This is an underlying restriction in {@link com.lowagie.text.pdf.ColumnText} @throws DocumentException if element can't be added

public void AddElement(IElement element)

Parameters

element IElement

element to add

AddRegularColumns(float, float, float, int)

Add the specified number of evenly spaced rectangular columns. Columns will be seperated by the specified gutterWidth.

public void AddRegularColumns(float left, float right, float gutterWidth, int numColumns)

Parameters

left float

left boundary of first column

right float

right boundary of last column

gutterWidth float

width of gutter spacing between columns

numColumns int

number of columns to add

AddSimpleColumn(float, float)

Add a simple rectangular column with specified left and right x position boundaries.

public void AddSimpleColumn(float left, float right)

Parameters

left float

left boundary

right float

right boundary

AddText(Chunk)

Adds a Chunk to the current text array. Will not have any effect if addElement() was called before. @since 2.1.5

public void AddText(Chunk chunk)

Parameters

chunk Chunk

the text

AddText(Phrase)

Adds a Phrase to the current text array. Will not have any effect if addElement() was called before. @since 2.1.5

public void AddText(Phrase phrase)

Parameters

phrase Phrase

the text

IsContent()

@see com.lowagie.text.Element#isContent() @since iText 2.0.8

public bool IsContent()

Returns

bool

IsNestable()

@see com.lowagie.text.Element#isNestable() @since iText 2.0.8

public bool IsNestable()

Returns

bool

IsOverflow()

Indicates that all of the text did not fit in the specified height. Note that isOverflow will return false before the MultiColumnText object has been added to the document. It will always be false if the height is AUTOMATIC.

public bool IsOverflow()

Returns

bool

true if there is still space left in the column

NextColumn()

Moves the text insertion point to the beginning of the next column, issuing a page break if needed. @throws DocumentException on error

public void NextColumn()

Process(IElementListener)

Processes the element by adding it to an ElementListener .

public bool Process(IElementListener listener)

Parameters

listener IElementListener

an ElementListener

Returns

bool

true if the element was processed successfully

ResetCurrentColumn()

Resets the current column.

public void ResetCurrentColumn()

SetColumnsRightToLeft(bool)

Sets the direction of the columns.

public void SetColumnsRightToLeft(bool direction)

Parameters

direction bool

true = right2left; false = left2right

ShiftCurrentColumn()

Shifts the current column.

public bool ShiftCurrentColumn()

Returns

bool

true if the currentcolumn has changed

UseColumnParams(ColumnText)

Copy the parameters from the specified ColumnText to use when rendering. Parameters like setArabicOptions must be set in this way.

public void UseColumnParams(ColumnText sourceColumn)

Parameters

sourceColumn ColumnText

Write(PdfContentByte, PdfDocument, float)

Write out the columns. After writing, use {@link #isOverflow()} to see if all text was written. @throws DocumentException on error

public float Write(PdfContentByte canvas, PdfDocument document, float documentY)

Parameters

canvas PdfContentByte

PdfContentByte to write with

document PdfDocument

document to write to (only used to get page limit info)

documentY float

starting y position to begin writing at

Returns

float

the current height (y position) after writing the columns