com.lowagie.text.pdf
public class MultiColumnText extends Object implements Element
Document.add
.
Nested Class Summary | |
---|---|
class | MultiColumnText.ColumnDef
Inner class used to define a column |
Field Summary | |
---|---|
static float | AUTOMATIC special constant for automatic calculation of height |
ArrayList | columnDefs
Array of ColumnDef objects used to define the columns |
boolean | columnsRightToLeft |
ColumnText | columnText
ColumnText object used to do all the real work. |
int | currentColumn |
float | desiredHeight
total desiredHeight of columns. |
PdfDocument | document |
float | nextY |
boolean | overflow
true if all the text could not be written out due to height restriction |
float | pageBottom
used to store the y position of the bottom of the page |
boolean | simple
true if all columns are simple (rectangular) |
float | top
Top of the columns - y position on starting page.
|
float | totalHeight
total height of element written out so far |
Constructor Summary | |
---|---|
MultiColumnText()
Default constructor. | |
MultiColumnText(float height)
Construct a MultiColumnText container of the specified height.
| |
MultiColumnText(float top, float height)
Construct a MultiColumnText container of the specified height
starting at the specified Y position.
|
Method Summary | |
---|---|
void | addColumn(float[] left, float[] right)
Add a new column. |
void | addElement(Element element)
Add an element to be rendered in a column.
|
void | addRegularColumns(float left, float right, float gutterWidth, int numColumns)
Add the specified number of evenly spaced rectangular columns.
|
void | addSimpleColumn(float left, float right)
Add a simple rectangular column with specified left
and right x position boundaries.
|
ArrayList | getChunks()
Returns null - not used
|
float | getColumnBottom()
Calculates the appropriate y position for the bottom
of the columns on this page.
|
int | getCurrentColumn()
Gets the current column. |
float | getHeight(float[] left, float[] right)
Figure out the height of a column from the border extents
|
boolean | isOverflow()
Indicates that all of the text did not fit in the
specified height. |
void | newPage() |
void | nextColumn()
Moves the text insertion point to the beginning of the next column, issuing a page break if
needed. |
boolean | process(ElementListener listener)
Processes the element by adding it to an
ElementListener .
|
void | resetCurrentColumn()
Resets the current column. |
void | setAlignment(int alignment) Sets the default alignment |
void | setArabicOptions(int arabicOptions) Sets the arabic shaping options. |
void | setColumnsRightToLeft(boolean direction)
Sets the direction of the columns. |
void | setRunDirection(int runDirection) Sets the run direction. |
void | setSpaceCharRatio(float spaceCharRatio) Sets the ratio between the extra word spacing and the extra character spacing
when the text is fully justified.
|
boolean | shiftCurrentColumn()
Shifts the current column. |
int | type()
Gets the type of the text element.
|
void | useColumnParams(ColumnText sourceColumn)
Copy the parameters from the specified ColumnText to use
when rendering. |
float | write(PdfContentByte canvas, PdfDocument document, float documentY)
Write out the columns. |
ColumnDef
objects used to define the columnsAUTOMATIC
, this means fill pages until done.
This may be larger than one pageAUTOMATIC
, it means current y position when added to documentAUTOMATIC
.
Columns will repeat on each page as necessary to accomodate content length.AUTOMATIC
, fill complete pages until done.
If a specific height is used, it may span one or more pages.
Parameters: height
Parameters: height top
Parameters: left limits for left column right limits for right column
Phrase
or a Chunk
if the columns are
not all simple. This is an underlying restriction in
ColumnText
Parameters: element element to add
Throws: DocumentException if element can't be added
Parameters: left left boundary of first column right right boundary of last column gutterWidth width of gutter spacing between columns numColumns number of columns to add
Parameters: left left boundary right right boundary
Returns: null
Returns: the y position of the bottom of the columns
Returns: the current column
Parameters: left left border right right border
Returns: height
Returns: true if there is still space left in the column
Throws: DocumentException on error
ElementListener
.
Parameters: listener an ElementListener
Returns: true
if the element was processed successfully
Parameters: alignment the default alignment
Parameters: arabicOptions the arabic shaping options
Parameters: direction true = right2left; false = left2right
Parameters: runDirection the run direction
spaceCharRatio
times more than extra character spacing.
If the ratio is PdfWriter.NO_SPACE_CHAR_RATIO
then the extra character spacing
will be zero.Parameters: spaceCharRatio the ratio between the extra word spacing and the extra character spacing
Returns: true if the currentcolumn has changed
Returns: a type
setArabicOptions
must be set in this way.
Parameters: sourceColumn
Parameters: canvas PdfContentByte to write with document document to write to (only used to get page limit info) documentY starting y position to begin writing at
Returns: the current height (y position) after writing the columns
Throws: DocumentException on error