com.lowagie.text.pdf

Class VerticalText

public class VerticalText extends Object

Writes text vertically. Note that the naming is done according to horizontal text although it referrs to vertical text. A line with the alignment Element.LEFT_ALIGN will actually be top aligned.
Field Summary
protected intalignment
The column alignment.
protected ArrayListchunks
The chunks that form the text.
protected intcurrentChunkMarker
Marks the chunks to be eliminated when the line is written.
protected PdfChunkcurrentStandbyChunk
The chunk created by the splitting.
protected floatheight
The height of the text.
protected floatleading
The leading
protected intmaxLines
The maximum number of vertical lines.
static intNO_MORE_COLUMN
Signals that there is no more column.
static intNO_MORE_TEXT
Signals that there are no more text available.
protected StringsplittedChunkText
The chunk created by the splitting.
protected floatstartX
The X coordinate.
protected floatstartY
The Y coordinate.
protected PdfContentBytetext
The PdfContent where the text will be written to.
Constructor Summary
VerticalText(PdfContentByte text)
Creates new VerticalText
Method Summary
voidaddText(Phrase phrase)
Adds a Phrase to the current text array.
voidaddText(Chunk chunk)
Adds a Chunk to the current text array.
protected PdfLinecreateLine(float width)
Creates a line from the chunk array.
intgetAlignment()
Gets the alignment.
floatgetHeight()
Gets the height of the line
floatgetLeading()
Gets the separation between the vertical lines.
intgetMaxLines()
Gets the maximum number of available lines.
floatgetOriginX()
Gets the X coordinate where the next line will be writen.
floatgetOriginY()
Gets the Y coordinate where the next line will be writen.
intgo()
Outputs the lines to the document.
intgo(boolean simulate)
Outputs the lines to the document.
voidsetAlignment(int alignment)
Sets the alignment.
voidsetHeight(float height)
Sets the height of the line
voidsetLeading(float leading)
Sets the separation between the vertical lines.
voidsetMaxLines(int maxLines)
Sets the maximum number of lines.
voidsetOrigin(float startX, float startY)
Sets the new text origin.
voidsetVerticalLayout(float startX, float startY, float height, int maxLines, float leading)
Sets the layout.
protected voidshortenChunkArray()
Normalizes the list of chunks when the line is accepted.
voidwriteLine(PdfLine line, PdfContentByte text, PdfContentByte graphics)

Field Detail

alignment

protected int alignment
The column alignment. Default is left alignment.

chunks

protected ArrayList chunks
The chunks that form the text.

currentChunkMarker

protected int currentChunkMarker
Marks the chunks to be eliminated when the line is written.

currentStandbyChunk

protected PdfChunk currentStandbyChunk
The chunk created by the splitting.

height

protected float height
The height of the text.

leading

protected float leading
The leading

maxLines

protected int maxLines
The maximum number of vertical lines.

NO_MORE_COLUMN

public static final int NO_MORE_COLUMN
Signals that there is no more column.

NO_MORE_TEXT

public static final int NO_MORE_TEXT
Signals that there are no more text available.

splittedChunkText

protected String splittedChunkText
The chunk created by the splitting.

startX

protected float startX
The X coordinate.

startY

protected float startY
The Y coordinate.

text

protected PdfContentByte text
The PdfContent where the text will be written to.

Constructor Detail

VerticalText

public VerticalText(PdfContentByte text)
Creates new VerticalText

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

Method Detail

addText

public void addText(Phrase phrase)
Adds a Phrase to the current text array.

Parameters: phrase the text

addText

public void addText(Chunk chunk)
Adds a Chunk to the current text array.

Parameters: chunk the text

createLine

protected PdfLine createLine(float width)
Creates a line from the chunk array.

Parameters: width the width of the line

Returns: the line or null if no more chunks

getAlignment

public int getAlignment()
Gets the alignment.

Returns: the alignment

getHeight

public float getHeight()
Gets the height of the line

Returns: the height

getLeading

public float getLeading()
Gets the separation between the vertical lines.

Returns: the vertical line separation

getMaxLines

public int getMaxLines()
Gets the maximum number of available lines. This value will change after each call to go().

Returns: Value of property maxLines.

getOriginX

public float getOriginX()
Gets the X coordinate where the next line will be writen. This value will change after each call to go().

Returns: the X coordinate

getOriginY

public float getOriginY()
Gets the Y coordinate where the next line will be writen.

Returns: the Y coordinate

go

public int 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

go

public int go(boolean simulate)
Outputs the lines to the document. The output can be simulated.

Parameters: simulate true 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

setAlignment

public void setAlignment(int alignment)
Sets the alignment.

Parameters: alignment the alignment

setHeight

public void setHeight(float height)
Sets the height of the line

Parameters: height the new height

setLeading

public void setLeading(float leading)
Sets the separation between the vertical lines.

Parameters: leading the vertical line separation

setMaxLines

public void setMaxLines(int maxLines)
Sets the maximum number of lines.

Parameters: maxLines the maximum number of lines

setOrigin

public void setOrigin(float startX, float startY)
Sets the new text origin.

Parameters: startX the X coordinate startY the Y coordinate

setVerticalLayout

public void setVerticalLayout(float startX, float startY, float height, int maxLines, float leading)
Sets the layout.

Parameters: startX the top right X line position startY the top right Y line position height the height of the lines maxLines the maximum number of lines leading the separation between the lines

shortenChunkArray

protected void shortenChunkArray()
Normalizes the list of chunks when the line is accepted.

writeLine

void writeLine(PdfLine line, PdfContentByte text, PdfContentByte graphics)