HiraokaHyperTools.iTextSharp-LGPL  0.2.5
iTextSharp.text.pdf.ColumnText Class Reference

Public Member Functions

 ColumnText (PdfContentByte canvas)
 
ColumnText SetACopy (ColumnText org)
 
void AddText (Phrase phrase)
 
void SetText (Phrase phrase)
 
void AddText (Chunk chunk)
 
void AddElement (IElement element)
 
void SetColumns (float[] leftLine, float[] rightLine)
 
void SetSimpleColumn (Phrase phrase, float llx, float lly, float urx, float ury, float leading, int alignment)
 
void SetSimpleColumn (float llx, float lly, float urx, float ury, float leading, int alignment)
 
void SetSimpleColumn (float llx, float lly, float urx, float ury)
 
void SetLeading (float fixedLeading, float multipliedLeading)
 
int Go ()
 
int Go (bool simulate)
 
void ClearChunks ()
 
bool ZeroHeightElement ()
 
void UpdateFilledWidth (float w)
 

Static Public Member Functions

static ColumnText Duplicate (ColumnText org)
 
static float GetWidth (Phrase phrase, int runDirection, int arabicOptions)
 
static float GetWidth (Phrase phrase)
 
static void ShowTextAligned (PdfContentByte canvas, int alignment, Phrase phrase, float x, float y, float rotation, int runDirection, int arabicOptions)
 
static void ShowTextAligned (PdfContentByte canvas, int alignment, Phrase phrase, float x, float y, float rotation)
 
static bool HasMoreText (int status)
 

Public Attributes

int AR_NOVOWEL = ArabicLigaturizer.ar_novowel
 

Static Public Attributes

const int AR_COMPOSEDTASHKEEL = ArabicLigaturizer.ar_composedtashkeel
 
const int AR_LIG = ArabicLigaturizer.ar_lig
 
const int DIGITS_EN2AN = ArabicLigaturizer.DIGITS_EN2AN
 
const int DIGITS_AN2EN = ArabicLigaturizer.DIGITS_AN2EN
 
const int DIGITS_EN2AN_INIT_LR = ArabicLigaturizer.DIGITS_EN2AN_INIT_LR
 
const int DIGITS_EN2AN_INIT_AL = ArabicLigaturizer.DIGITS_EN2AN_INIT_AL
 
const int DIGIT_TYPE_AN = ArabicLigaturizer.DIGIT_TYPE_AN
 
const int DIGIT_TYPE_AN_EXTENDED = ArabicLigaturizer.DIGIT_TYPE_AN_EXTENDED
 
static float GLOBAL_SPACE_CHAR_RATIO = 0
 
const int NO_MORE_TEXT = 1
 
const int NO_MORE_COLUMN = 2
 

Protected Member Functions

ArrayList ConvertColumn (float[] cLine)
 
float FindLimitsPoint (ArrayList wall)
 
float[] FindLimitsOneLine ()
 
float[] FindLimitsTwoLines ()
 
int GoComposite (bool simulate)
 

Protected Attributes

int runDirection = PdfWriter.RUN_DIRECTION_DEFAULT
 
float maxY
 
float minY
 
float leftX
 
float rightX
 
int alignment = Element.ALIGN_LEFT
 
ArrayList leftWall
 
ArrayList rightWall
 
BidiLine bidiLine
 
float yLine
 
float currentLeading = 16
 
float fixedLeading = 16
 
float multipliedLeading = 0
 
PdfContentByte canvas
 
PdfContentByte[] canvases
 
int lineStatus
 
float indent = 0
 
float followingIndent = 0
 
float rightIndent = 0
 
float extraParagraphSpace = 0
 
float rectangularWidth = -1
 
bool rectangularMode = false
 
float descender
 
bool composite = false
 
ColumnText compositeColumn
 
int listIdx = 0
 
Phrase waitPhrase
 

Static Protected Attributes

const int LINE_STATUS_OK = 0
 
const int LINE_STATUS_OFFLIMITS = 1
 
const int LINE_STATUS_NOLINE = 2
 

Properties

float Leading [get, set]
 
float MultipliedLeading [get]
 
float YLine [get, set]
 
int Alignment [get, set]
 
float Indent [get, set]
 
float FollowingIndent [get, set]
 
float RightIndent [get, set]
 
float ExtraParagraphSpace [get, set]
 
float SpaceCharRatio [get, set]
 
int RunDirection [get, set]
 
int LinesWritten [get]
 
int ArabicOptions [get, set]
 
float Descender [get]
 
PdfContentByte Canvas [get, set]
 
PdfContentByte[] Canvases [get, set]
 
bool UseAscender [get, set]
 
float FilledWidth [get, set]
 
bool AdjustFirstLine [get, set]
 

Detailed Description

Formats text in a columnwise form. The text is bound on the left and on the right by a sequence of lines. This allows the column to have any shape, not only rectangular.

Several parameters can be set like the first paragraph line indent and extra space between paragraphs.

A call to the method go will return one of the following situations: the column ended or the text ended.

I the column ended, a new column definition can be loaded with the method setColumns and the method go can be called again.

If the text ended, more text can be loaded with addText and the method go can be called again.
The only limitation is that one or more complete paragraphs must be loaded each time.

Full bidirectional reordering is supported. If the run direction is PdfWriter.RUN_DIRECTION_RTL the meaning of the horizontal alignments and margins is mirrored.

Author
Paulo Soares (psoar.nosp@m.es@c.nosp@m.onsis.nosp@m.te.p.nosp@m.t)

Constructor & Destructor Documentation

◆ ColumnText()

iTextSharp.text.pdf.ColumnText.ColumnText ( PdfContentByte  canvas)

Creates a ColumnText.

Parameters
textthe place where the text will be written to. Can be a template.

Member Function Documentation

◆ AddElement()

void iTextSharp.text.pdf.ColumnText.AddElement ( IElement  element)

Adds an element. Elements supported are Paragraph, List, PdfPTable, Image and Graphic.

It removes all the text placed with addText().

Parameters
elementthe Element

◆ AddText() [1/2]

void iTextSharp.text.pdf.ColumnText.AddText ( Chunk  chunk)

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

Parameters
chunkthe text

◆ AddText() [2/2]

void iTextSharp.text.pdf.ColumnText.AddText ( Phrase  phrase)

Adds a Phrase to the current text array.

Parameters
phrasethe text

◆ ClearChunks()

void iTextSharp.text.pdf.ColumnText.ClearChunks ( )

Clears the chunk array. A call to go() will always return NO_MORE_TEXT.

◆ ConvertColumn()

ArrayList iTextSharp.text.pdf.ColumnText.ConvertColumn ( float[]  cLine)
protected

Converts a sequence of lines representing one of the column bounds into an internal format.

Each array element will contain a float[4] representing the line x = ax + b.

Parameters
cLinethe column array
Returns
the converted array

◆ Duplicate()

static ColumnText iTextSharp.text.pdf.ColumnText.Duplicate ( ColumnText  org)
static

Creates an independent duplicated of the instance org.

Parameters
orgthe original ColumnText
Returns
the duplicated

◆ FindLimitsOneLine()

float [] iTextSharp.text.pdf.ColumnText.FindLimitsOneLine ( )
protected

Finds the intersection between the yLine and the two column bounds. It will set the lineStatus apropriatly.

Returns
a float[2]with the x coordinates of the intersection

◆ FindLimitsPoint()

float iTextSharp.text.pdf.ColumnText.FindLimitsPoint ( ArrayList  wall)
protected

Finds the intersection between the yLine and the column. It will set the lineStatus apropriatly.

Parameters
wallthe column to intersect
Returns
the x coordinate of the intersection

◆ FindLimitsTwoLines()

float [] iTextSharp.text.pdf.ColumnText.FindLimitsTwoLines ( )
protected

Finds the intersection between the yLine, the yLine-leadingand the two column bounds. It will set the lineStatus apropriatly.

Returns
a float[4]with the x coordinates of the intersection

◆ GetWidth() [1/2]

static float iTextSharp.text.pdf.ColumnText.GetWidth ( Phrase  phrase)
static

Gets the width that the line will occupy after writing. Only the width of the first line is returned.

Parameters
phrasethe Phrase containing the line
Returns
the width of the line

◆ GetWidth() [2/2]

static float iTextSharp.text.pdf.ColumnText.GetWidth ( Phrase  phrase,
int  runDirection,
int  arabicOptions 
)
static

Gets the width that the line will occupy after writing. Only the width of the first line is returned.

Parameters
phrasethe Phrase containing the line
runDirectionthe run direction
arabicOptionsthe options for the arabic shaping
Returns
the width of the line

◆ Go() [1/2]

int iTextSharp.text.pdf.ColumnText.Go ( )

Outputs the lines to the document. It is equivalent to go(false).

Returns
returns the result of the operation. It can be NO_MORE_TEXT and/or NO_MORE_COLUMN
Exceptions
DocumentExceptionon error

◆ Go() [2/2]

int iTextSharp.text.pdf.ColumnText.Go ( bool  simulate)

Outputs the lines to the document. The output can be simulated.

Parameters
simulatetrue to simulate the writting to the document
Returns
returns the result of the operation. It can be NO_MORE_TEXT and/or NO_MORE_COLUMN
Exceptions
DocumentExceptionon error

◆ GoComposite()

int iTextSharp.text.pdf.ColumnText.GoComposite ( bool  simulate)
protected

◆ HasMoreText()

static bool iTextSharp.text.pdf.ColumnText.HasMoreText ( int  status)
static

Checks the status variable and looks if there's still some text.

◆ SetACopy()

ColumnText iTextSharp.text.pdf.ColumnText.SetACopy ( ColumnText  org)

Makes this instance an independent copy of org.

Parameters
orgthe original ColumnText
Returns
itself

◆ SetColumns()

void iTextSharp.text.pdf.ColumnText.SetColumns ( float[]  leftLine,
float[]  rightLine 
)

Sets the columns bounds. Each column bound is described by a float[] with the line points [x1,y1,x2,y2,...]. The array must have at least 4 elements.

Parameters
leftLinethe left column bound
rightLinethe right column bound

◆ SetLeading()

void iTextSharp.text.pdf.ColumnText.SetLeading ( float  fixedLeading,
float  multipliedLeading 
)

Sets the leading fixed and variable. The resultant leading will be fixedLeading+multipliedLeading*maxFontSize where maxFontSize is the size of the bigest font in the line.

Parameters
fixedLeadingthe fixed leading
multipliedLeadingthe variable leading

◆ SetSimpleColumn() [1/3]

void iTextSharp.text.pdf.ColumnText.SetSimpleColumn ( float  llx,
float  lly,
float  urx,
float  ury 
)

Simplified method for rectangular columns.

Parameters
llx
lly
urx
ury

◆ SetSimpleColumn() [2/3]

void iTextSharp.text.pdf.ColumnText.SetSimpleColumn ( float  llx,
float  lly,
float  urx,
float  ury,
float  leading,
int  alignment 
)

Simplified method for rectangular columns.

Parameters
llxthe lower left x corner
llythe lower left y corner
urxthe upper right x corner
urythe upper right y corner
leadingthe leading
alignmentthe column alignment

◆ SetSimpleColumn() [3/3]

void iTextSharp.text.pdf.ColumnText.SetSimpleColumn ( Phrase  phrase,
float  llx,
float  lly,
float  urx,
float  ury,
float  leading,
int  alignment 
)

Simplified method for rectangular columns.

Parameters
phrasea Phrase
llxthe lower left x corner
llythe lower left y corner
urxthe upper right x corner
urythe upper right y corner
leadingthe leading
alignmentthe column alignment

◆ SetText()

void iTextSharp.text.pdf.ColumnText.SetText ( Phrase  phrase)

Replaces the current text array with this Phrase. Anything added previously with AddElement() is lost.

Parameters
phrasethe text

◆ ShowTextAligned() [1/2]

static void iTextSharp.text.pdf.ColumnText.ShowTextAligned ( PdfContentByte  canvas,
int  alignment,
Phrase  phrase,
float  x,
float  y,
float  rotation 
)
static

Shows a line of text. Only the first line is written.

Parameters
canvaswhere the text is to be written to
alignmentthe alignment
phrasethe Phrase with the text
xthe x reference position
ythe y reference position
rotationthe rotation to be applied in degrees counterclockwise

◆ ShowTextAligned() [2/2]

static void iTextSharp.text.pdf.ColumnText.ShowTextAligned ( PdfContentByte  canvas,
int  alignment,
Phrase  phrase,
float  x,
float  y,
float  rotation,
int  runDirection,
int  arabicOptions 
)
static

Shows a line of text. Only the first line is written.

Parameters
canvaswhere the text is to be written to
alignmentthe alignment. It is not influenced by the run direction
phrasethe Phrase with the text
xthe x reference position
ythe y reference position
rotationthe rotation to be applied in degrees counterclockwise
runDirectionthe run direction
arabicOptionsthe options for the arabic shaping

◆ UpdateFilledWidth()

void iTextSharp.text.pdf.ColumnText.UpdateFilledWidth ( float  w)

Replaces the filledWidth if greater than the existing one.

Parameters
wthe new filledWidth if greater than the existing one

◆ ZeroHeightElement()

bool iTextSharp.text.pdf.ColumnText.ZeroHeightElement ( )

Checks if the element has a height of 0.

Returns
true or false
Since
2.1.2

Member Data Documentation

◆ alignment

int iTextSharp.text.pdf.ColumnText.alignment = Element.ALIGN_LEFT
protected

The column Element. Default is left Element.

◆ AR_COMPOSEDTASHKEEL

const int iTextSharp.text.pdf.ColumnText.AR_COMPOSEDTASHKEEL = ArabicLigaturizer.ar_composedtashkeel
static

Compose the tashkeel in the ligatures.

◆ AR_LIG

const int iTextSharp.text.pdf.ColumnText.AR_LIG = ArabicLigaturizer.ar_lig
static

Do some extra double ligatures.

◆ AR_NOVOWEL

int iTextSharp.text.pdf.ColumnText.AR_NOVOWEL = ArabicLigaturizer.ar_novowel

Eliminate the arabic vowels

◆ bidiLine

BidiLine iTextSharp.text.pdf.ColumnText.bidiLine
protected

The chunks that form the text.

◆ canvas

PdfContentByte iTextSharp.text.pdf.ColumnText.canvas
protected

The PdfContent where the text will be written to.

◆ canvases

PdfContentByte [] iTextSharp.text.pdf.ColumnText.canvases
protected

◆ composite

bool iTextSharp.text.pdf.ColumnText.composite = false
protected

◆ compositeColumn

ColumnText iTextSharp.text.pdf.ColumnText.compositeColumn
protected

◆ currentLeading

float iTextSharp.text.pdf.ColumnText.currentLeading = 16
protected

The leading for the current line.

◆ descender

float iTextSharp.text.pdf.ColumnText.descender
protected

◆ DIGIT_TYPE_AN

const int iTextSharp.text.pdf.ColumnText.DIGIT_TYPE_AN = ArabicLigaturizer.DIGIT_TYPE_AN
static

Digit type option: Use Arabic-Indic digits (U+0660...U+0669).

◆ DIGIT_TYPE_AN_EXTENDED

const int iTextSharp.text.pdf.ColumnText.DIGIT_TYPE_AN_EXTENDED = ArabicLigaturizer.DIGIT_TYPE_AN_EXTENDED
static

Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9).

◆ DIGITS_AN2EN

const int iTextSharp.text.pdf.ColumnText.DIGITS_AN2EN = ArabicLigaturizer.DIGITS_AN2EN
static

Digit shaping option: Replace Arabic-Indic digits by European digits (U+0030...U+0039).

◆ DIGITS_EN2AN

const int iTextSharp.text.pdf.ColumnText.DIGITS_EN2AN = ArabicLigaturizer.DIGITS_EN2AN
static

Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits.

◆ DIGITS_EN2AN_INIT_AL

const int iTextSharp.text.pdf.ColumnText.DIGITS_EN2AN_INIT_AL = ArabicLigaturizer.DIGITS_EN2AN_INIT_AL
static

Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits if the most recent strongly directional character is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC). The initial state at the start of the text is assumed to be an Arabic, letter, so European digits at the start of the text will change. Compare to DIGITS_ALEN2AN_INT_LR.

◆ DIGITS_EN2AN_INIT_LR

const int iTextSharp.text.pdf.ColumnText.DIGITS_EN2AN_INIT_LR = ArabicLigaturizer.DIGITS_EN2AN_INIT_LR
static

Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits if the most recent strongly directional character is an Arabic letter (its Bidi direction value is RIGHT_TO_LEFT_ARABIC). The initial state at the start of the text is assumed to be not an Arabic, letter, so European digits at the start of the text will not change. Compare to DIGITS_ALEN2AN_INIT_AL.

◆ extraParagraphSpace

float iTextSharp.text.pdf.ColumnText.extraParagraphSpace = 0
protected

The extra space between paragraphs.

◆ fixedLeading

float iTextSharp.text.pdf.ColumnText.fixedLeading = 16
protected

The fixed text leading.

◆ followingIndent

float iTextSharp.text.pdf.ColumnText.followingIndent = 0
protected

The following paragraph lines indent.

◆ GLOBAL_SPACE_CHAR_RATIO

float iTextSharp.text.pdf.ColumnText.GLOBAL_SPACE_CHAR_RATIO = 0
static

◆ indent

float iTextSharp.text.pdf.ColumnText.indent = 0
protected

The first paragraph line indent.

◆ leftWall

ArrayList iTextSharp.text.pdf.ColumnText.leftWall
protected

The left column bound.

◆ leftX

float iTextSharp.text.pdf.ColumnText.leftX
protected

◆ LINE_STATUS_NOLINE

const int iTextSharp.text.pdf.ColumnText.LINE_STATUS_NOLINE = 2
staticprotected

The line cannot fit this column position.

◆ LINE_STATUS_OFFLIMITS

const int iTextSharp.text.pdf.ColumnText.LINE_STATUS_OFFLIMITS = 1
staticprotected

The line is out the column limits.

◆ LINE_STATUS_OK

const int iTextSharp.text.pdf.ColumnText.LINE_STATUS_OK = 0
staticprotected

The column is valid.

◆ lineStatus

int iTextSharp.text.pdf.ColumnText.lineStatus
protected

The line status when trying to fit a line to a column.

◆ listIdx

int iTextSharp.text.pdf.ColumnText.listIdx = 0
protected

◆ maxY

float iTextSharp.text.pdf.ColumnText.maxY
protected

Upper bound of the column.

◆ minY

float iTextSharp.text.pdf.ColumnText.minY
protected

Lower bound of the column.

◆ multipliedLeading

float iTextSharp.text.pdf.ColumnText.multipliedLeading = 0
protected

The text leading that is multiplied by the biggest font size in the line.

◆ NO_MORE_COLUMN

const int iTextSharp.text.pdf.ColumnText.NO_MORE_COLUMN = 2
static

Signals that there is no more column.

◆ NO_MORE_TEXT

const int iTextSharp.text.pdf.ColumnText.NO_MORE_TEXT = 1
static

Signals that there is no more text available.

◆ rectangularMode

bool iTextSharp.text.pdf.ColumnText.rectangularMode = false
protected

◆ rectangularWidth

float iTextSharp.text.pdf.ColumnText.rectangularWidth = -1
protected

The width of the line when the column is defined as a simple rectangle.

◆ rightIndent

float iTextSharp.text.pdf.ColumnText.rightIndent = 0
protected

The right paragraph lines indent.

◆ rightWall

ArrayList iTextSharp.text.pdf.ColumnText.rightWall
protected

The right column bound.

◆ rightX

float iTextSharp.text.pdf.ColumnText.rightX
protected

◆ runDirection

int iTextSharp.text.pdf.ColumnText.runDirection = PdfWriter.RUN_DIRECTION_DEFAULT
protected

◆ waitPhrase

Phrase iTextSharp.text.pdf.ColumnText.waitPhrase
protected

◆ yLine

float iTextSharp.text.pdf.ColumnText.yLine
protected

The current y line location. Text will be written at this line minus the leading.

Property Documentation

◆ AdjustFirstLine

bool iTextSharp.text.pdf.ColumnText.AdjustFirstLine
getset

Sets the first line adjustment. Some objects have properties, like spacing before, that behave differently if the object is the first to be written after go() or not. The first line adjustment is true by default but can be changed if several objects are to be placed one after the other in the same column calling go() several times.

Parameters
adjustFirstLinetrue to adjust the first line, false otherwise

◆ Alignment

int iTextSharp.text.pdf.ColumnText.Alignment
getset

Gets the Element.

Returns
the alignment

◆ ArabicOptions

int iTextSharp.text.pdf.ColumnText.ArabicOptions
getset

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

Parameters
arabicOptionsthe arabic shaping options

◆ Canvas

PdfContentByte iTextSharp.text.pdf.ColumnText.Canvas
getset

Sets the canvas.

Parameters
canvas

◆ Canvases

PdfContentByte [] iTextSharp.text.pdf.ColumnText.Canvases
getset

Sets the canvases.

Parameters
canvas

◆ Descender

float iTextSharp.text.pdf.ColumnText.Descender
get

Gets the biggest descender value of the last line written.

Returns
the biggest descender value of the last line written

◆ ExtraParagraphSpace

float iTextSharp.text.pdf.ColumnText.ExtraParagraphSpace
getset

Sets the extra space between paragraphs.

Returns
the extra space between paragraphs

◆ FilledWidth

float iTextSharp.text.pdf.ColumnText.FilledWidth
getset

Sets the real width used by the largest line. Only used to set it to zero to start another measurement.

Parameters
filledWidththe real width used by the largest line

◆ FollowingIndent

float iTextSharp.text.pdf.ColumnText.FollowingIndent
getset

Gets the following paragraph lines indent.

Returns
the indent

◆ Indent

float iTextSharp.text.pdf.ColumnText.Indent
getset

Gets the first paragraph line indent.

Returns
the indent

◆ Leading

float iTextSharp.text.pdf.ColumnText.Leading
getset

Gets the fixed leading

Returns
the leading

◆ LinesWritten

int iTextSharp.text.pdf.ColumnText.LinesWritten
get

Gets the number of lines written.

Returns
the number of lines written

◆ MultipliedLeading

float iTextSharp.text.pdf.ColumnText.MultipliedLeading
get

Gets the variable leading

Returns
the leading

◆ RightIndent

float iTextSharp.text.pdf.ColumnText.RightIndent
getset

Gets the right paragraph lines indent.

Returns
the indent

◆ RunDirection

int iTextSharp.text.pdf.ColumnText.RunDirection
getset

Gets the run direction.

Returns
the run direction

◆ SpaceCharRatio

float iTextSharp.text.pdf.ColumnText.SpaceCharRatio
getset

Gets the space/character extra spacing ratio for fully justified text.

Returns
the space/character extra spacing ratio

◆ UseAscender

bool iTextSharp.text.pdf.ColumnText.UseAscender
getset

Enables/Disables adjustment of first line height based on max ascender.

Parameters
useenable adjustment if true

◆ YLine

float iTextSharp.text.pdf.ColumnText.YLine
getset

Gets the yLine.

Returns
the yLine

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