Save This Page
Home » iText-src-2.1.3 » com.lowagie » text » pdf » [javadoc | source]
com.lowagie.text.pdf
public class: ColumnText [javadoc | source]
java.lang.Object
   com.lowagie.text.pdf.ColumnText
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.

Field Summary
public static final  int AR_NOVOWEL    Eliminate the arabic vowels 
public static final  int AR_COMPOSEDTASHKEEL    Compose the tashkeel in the ligatures. 
public static final  int AR_LIG    Do some extra double ligatures. 
public static final  int DIGITS_EN2AN    Digit shaping option: Replace European digits (U+0030...U+0039) by Arabic-Indic digits. 
public static final  int DIGITS_AN2EN    Digit shaping option: Replace Arabic-Indic digits by European digits (U+0030...U+0039). 
public static final  int DIGITS_EN2AN_INIT_LR    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. 
public static final  int DIGITS_EN2AN_INIT_AL    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. 
public static final  int DIGIT_TYPE_AN    Digit type option: Use Arabic-Indic digits (U+0660...U+0669). 
public static final  int DIGIT_TYPE_AN_EXTENDED    Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9). 
protected  int runDirection     
public static final  float GLOBAL_SPACE_CHAR_RATIO    the space char ratio 
public static final  int START_COLUMN    Initial value of the status. 
public static final  int NO_MORE_TEXT    Signals that there is no more text available. 
public static final  int NO_MORE_COLUMN    Signals that there is no more column. 
protected static final  int LINE_STATUS_OK    The column is valid. 
protected static final  int LINE_STATUS_OFFLIMITS    The line is out the column limits. 
protected static final  int LINE_STATUS_NOLINE    The line cannot fit this column position. 
protected  float maxY    Upper bound of the column. 
protected  float minY    Lower bound of the column. 
protected  float leftX     
protected  float rightX     
protected  int alignment    The column alignment. Default is left alignment. 
protected  ArrayList leftWall    The left column bound. 
protected  ArrayList rightWall    The right column bound. 
protected  BidiLine bidiLine    The chunks that form the text. 
protected  float yLine    The current y line location. Text will be written at this line minus the leading. 
protected  float currentLeading    The leading for the current line. 
protected  float fixedLeading    The fixed text leading. 
protected  float multipliedLeading    The text leading that is multiplied by the biggest font size in the line. 
protected  PdfContentByte canvas    The PdfContent where the text will be written to. 
protected  PdfContentByte[] canvases     
protected  int lineStatus    The line status when trying to fit a line to a column. 
protected  float indent    The first paragraph line indent. 
protected  float followingIndent    The following paragraph lines indent. 
protected  float rightIndent    The right paragraph lines indent. 
protected  float extraParagraphSpace    The extra space between paragraphs. 
protected  float rectangularWidth    The width of the line when the column is defined as a simple rectangle. 
protected  boolean rectangularMode     
protected  float descender     
protected  boolean composite     
protected  ColumnText compositeColumn     
protected  LinkedList compositeElements     
protected  int listIdx     
protected  Phrase waitPhrase     
Constructor:
 public ColumnText(PdfContentByte canvas) 
    Creates a ColumnText.
    Parameters:
    canvas - the place where the text will be written to. Can be a template.
Method from com.lowagie.text.pdf.ColumnText Summary:
addElement,   addText,   addText,   clearChunks,   convertColumn,   duplicate,   findLimitsOneLine,   findLimitsPoint,   findLimitsTwoLines,   getAlignment,   getArabicOptions,   getCanvas,   getCanvases,   getDescender,   getExtraParagraphSpace,   getFilledWidth,   getFollowingIndent,   getIndent,   getLeading,   getLinesWritten,   getMultipliedLeading,   getRightIndent,   getRunDirection,   getSpaceCharRatio,   getWidth,   getWidth,   getYLine,   go,   go,   goComposite,   hasMoreText,   isAdjustFirstLine,   isUseAscender,   setACopy,   setAdjustFirstLine,   setAlignment,   setArabicOptions,   setCanvas,   setCanvases,   setColumns,   setExtraParagraphSpace,   setFilledWidth,   setFollowingIndent,   setIndent,   setLeading,   setLeading,   setRightIndent,   setRunDirection,   setSimpleColumn,   setSimpleColumn,   setSimpleColumn,   setSimpleVars,   setSpaceCharRatio,   setText,   setUseAscender,   setYLine,   showTextAligned,   showTextAligned,   updateFilledWidth,   zeroHeightElement
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.lowagie.text.pdf.ColumnText Detail:
 public  void addElement(Element element) 
    Adds an element. Elements supported are Paragraph, List, PdfPTable, Image and Graphic.

    It removes all the text placed with addText().

 public  void addText(Phrase phrase) 
    Adds a Phrase to the current text array. Will not have any effect if addElement() was called before.
 public  void addText(Chunk chunk) 
    Adds a Chunk to the current text array. Will not have any effect if addElement() was called before.
 public  void clearChunks() 
    Clears the chunk array. A call to go() will always return NO_MORE_TEXT.
 protected ArrayList convertColumn(float[] cLine) 
    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.

 public static ColumnText duplicate(ColumnText org) 
    Creates an independent duplicated of the instance org.
 protected float[] findLimitsOneLine() 
    Finds the intersection between the yLine and the two column bounds. It will set the lineStatus appropriately.
 protected float findLimitsPoint(ArrayList wall) 
    Finds the intersection between the yLine and the column. It will set the lineStatus appropriately.
 protected float[] findLimitsTwoLines() 
    Finds the intersection between the yLine, the yLine-leadingand the two column bounds. It will set the lineStatus appropriately.
 public int getAlignment() 
    Gets the alignment.
 public int getArabicOptions() 
    Gets the arabic shaping options.
 public PdfContentByte getCanvas() 
    Gets the canvas.
 public PdfContentByte[] getCanvases() 
    Gets the canvases.
 public float getDescender() 
    Gets the biggest descender value of the last line written.
 public float getExtraParagraphSpace() 
    Sets the extra space between paragraphs.
 public float getFilledWidth() 
    Gets the real width used by the largest line.
 public float getFollowingIndent() 
    Gets the following paragraph lines indent.
 public float getIndent() 
    Gets the first paragraph line indent.
 public float getLeading() 
    Gets the fixed leading
 public int getLinesWritten() 
    Gets the number of lines written.
 public float getMultipliedLeading() 
    Gets the variable leading
 public float getRightIndent() 
    Gets the right paragraph lines indent.
 public int getRunDirection() 
    Gets the run direction.
 public float getSpaceCharRatio() 
    Gets the space/character extra spacing ratio for fully justified text.
 public static float getWidth(Phrase phrase) 
    Gets the width that the line will occupy after writing. Only the width of the first line is returned.
 public static float getWidth(Phrase phrase,
    int runDirection,
    int arabicOptions) 
    Gets the width that the line will occupy after writing. Only the width of the first line is returned.
 public float getYLine() 
    Gets the yLine.
 public int go() throws DocumentException 
    Outputs the lines to the document. It is equivalent to go(false).
 public int go(boolean simulate) throws DocumentException 
    Outputs the lines to the document. The output can be simulated.
 protected int goComposite(boolean simulate) throws DocumentException 
 public static boolean hasMoreText(int status) 
    Checks the status variable and looks if there's still some text.
 public boolean isAdjustFirstLine() 
    Gets the first line adjustment property.
 public boolean isUseAscender() 
    Checks if UseAscender is enabled/disabled.
 public ColumnText setACopy(ColumnText org) 
    Makes this instance an independent copy of org.
 public  void setAdjustFirstLine(boolean adjustFirstLine) 
    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.
 public  void setAlignment(int alignment) 
    Sets the alignment.
 public  void setArabicOptions(int arabicOptions) 
    Sets the arabic shaping options. The option can be AR_NOVOWEL, AR_COMPOSEDTASHKEEL and AR_LIG.
 public  void setCanvas(PdfContentByte canvas) 
    Sets the canvas.
 public  void setCanvases(PdfContentByte[] canvases) 
    Sets the canvases.
 public  void 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.
 public  void setExtraParagraphSpace(float extraParagraphSpace) 
    Sets the extra space between paragraphs.
 public  void setFilledWidth(float filledWidth) 
    Sets the real width used by the largest line. Only used to set it to zero to start another measurement.
 public  void setFollowingIndent(float indent) 
    Sets the following paragraph lines indent.
 public  void setIndent(float indent) 
    Sets the first paragraph line indent.
 public  void setLeading(float leading) 
    Sets the leading to fixed
 public  void 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 biggest font in the line.
 public  void setRightIndent(float indent) 
    Sets the right paragraph lines indent.
 public  void setRunDirection(int runDirection) 
    Sets the run direction.
 public  void setSimpleColumn(float llx,
    float lly,
    float urx,
    float ury) 
    Simplified method for rectangular columns.
 public  void setSimpleColumn(float llx,
    float lly,
    float urx,
    float ury,
    float leading,
    int alignment) 
    Simplified method for rectangular columns.
 public  void setSimpleColumn(Phrase phrase,
    float llx,
    float lly,
    float urx,
    float ury,
    float leading,
    int alignment) 
    Simplified method for rectangular columns.
 protected  void setSimpleVars(ColumnText org) 
 public  void setSpaceCharRatio(float 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  void setText(Phrase phrase) 
    Replaces the current text array with this Phrase. Anything added previously with addElement() is lost.
 public  void setUseAscender(boolean use) 
    Enables/Disables adjustment of first line height based on max ascender.
 public  void setYLine(float yLine) 
    Sets the yLine. The line will be written to yLine-leading.
 public static  void showTextAligned(PdfContentByte canvas,
    int alignment,
    Phrase phrase,
    float x,
    float y,
    float rotation) 
    Shows a line of text. Only the first line is written.
 public static  void showTextAligned(PdfContentByte canvas,
    int alignment,
    Phrase phrase,
    float x,
    float y,
    float rotation,
    int runDirection,
    int arabicOptions) 
    Shows a line of text. Only the first line is written.
 public  void updateFilledWidth(float w) 
    Replaces the filledWidth if greater than the existing one.
 public boolean zeroHeightElement() 
    Checks if the element has a height of 0.