|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.itextpdf.text.pdf.MultiColumnText
public class MultiColumnText
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
.
Field Summary | |
---|---|
static float |
AUTOMATIC
special constant for automatic calculation of height |
Fields inherited from interface com.itextpdf.text.Element |
---|
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CHAPTER, CHUNK, CREATIONDATE, CREATOR, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, SECTION, SUBJECT, TITLE, YMARK |
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. |
void |
addText(Chunk chunk)
Adds a Chunk to the current text array. |
void |
addText(Phrase phrase)
Adds a Phrase to the current text array. |
ArrayList<Chunk> |
getChunks()
Returns null - not used |
int |
getCurrentColumn()
Gets the current column. |
boolean |
isContent()
Checks if this element is a content object. |
boolean |
isNestable()
Checks if this element is nestable. |
boolean |
isOverflow()
Indicates that all of the text did not fit in the specified height. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.itextpdf.text.Element |
---|
toString |
Field Detail |
---|
public static final float AUTOMATIC
Constructor Detail |
---|
public MultiColumnText()
AUTOMATIC
.
Columns will repeat on each page as necessary to accommodate content length.
public MultiColumnText(float height)
AUTOMATIC
, fill complete pages until done.
If a specific height is used, it may span one or more pages.
height
- public MultiColumnText(float top, float height)
height
- top
- Method Detail |
---|
public boolean isOverflow()
public void useColumnParams(ColumnText sourceColumn)
setArabicOptions
must be set in this way.
sourceColumn
- public void addColumn(float[] left, float[] right)
left
- limits for left columnright
- limits for right columnpublic void addSimpleColumn(float left, float right)
left
- left boundaryright
- right boundarypublic void addRegularColumns(float left, float right, float gutterWidth, int numColumns)
left
- left boundary of first columnright
- right boundary of last columngutterWidth
- width of gutter spacing between columnsnumColumns
- number of columns to addpublic void addText(Phrase phrase)
Phrase
to the current text array.
Will not have any effect if addElement() was called before.
phrase
- the textpublic void addText(Chunk chunk)
Chunk
to the current text array.
Will not have any effect if addElement() was called before.
chunk
- the textpublic void addElement(Element element) throws DocumentException
Phrase
or a Chunk
if the columns are
not all simple. This is an underlying restriction in
ColumnText
element
- element to add
DocumentException
- if element can't be addedpublic float write(PdfContentByte canvas, PdfDocument document, float documentY) throws DocumentException
isOverflow()
to see if all text was written.
canvas
- PdfContentByte to write withdocument
- document to write to (only used to get page limit info)documentY
- starting y position to begin writing at
DocumentException
- on errorpublic boolean process(ElementListener listener)
ElementListener
.
process
in interface Element
listener
- an ElementListener
true
if the element was processed successfullypublic int type()
type
in interface Element
public ArrayList<Chunk> getChunks()
getChunks
in interface Element
public boolean isContent()
Element
isContent
in interface Element
Element.isContent()
public boolean isNestable()
Element
isNestable
in interface Element
Element.isNestable()
public void nextColumn() throws DocumentException
DocumentException
- on errorpublic int getCurrentColumn()
public void resetCurrentColumn()
public boolean shiftCurrentColumn()
public void setColumnsRightToLeft(boolean direction)
direction
- true = right2left; false = left2rightpublic void setSpaceCharRatio(float spaceCharRatio)
spaceCharRatio
times more than extra character spacing.
If the ratio is PdfWriter.NO_SPACE_CHAR_RATIO
then the extra character spacing
will be zero.
spaceCharRatio
- the ratio between the extra word spacing and the extra character spacingpublic void setRunDirection(int runDirection)
runDirection
- the run directionpublic void setArabicOptions(int arabicOptions)
arabicOptions
- the arabic shaping optionspublic void setAlignment(int alignment)
alignment
- the default alignment
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |