Package com.lowagie.text.pdf
Class VerticalText
java.lang.Object
com.lowagie.text.pdf.VerticalText
Writes text vertically. Note that the naming is done according to horizontal text although it refers to vertical
text. A line with the alignment Element.LEFT_ALIGN will actually be top aligned.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
The column alignment.The chunks that form the text.protected int
Marks the chunks to be eliminated when the line is written.protected PdfChunk
The chunk created by the splitting.protected float
The height of the text.protected float
The leadingprotected int
The maximum number of vertical lines.static final int
Signals that there is no more column.static final int
Signals that there are no more text available.protected String
The chunk created by the splitting.protected float
The X coordinate.protected float
The Y coordinate.protected PdfContentByte
ThePdfContent
where the text will be written to. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds aChunk
to the current text array.void
Adds aPhrase
to the current text array.protected PdfLine
createLine
(float width) Creates a line from the chunk array.int
Gets the alignment.float
Gets the height of the linefloat
Gets the separation between the vertical lines.int
Gets the maximum number of available lines.float
Gets the X coordinate where the next line will be written.float
Gets the Y coordinate where the next line will be written.int
go()
Outputs the lines to the document.int
go
(boolean simulate) Outputs the lines to the document.void
setAlignment
(int alignment) Sets the alignment.void
setHeight
(float height) Sets the height of the linevoid
setLeading
(float leading) Sets the separation between the vertical lines.void
setMaxLines
(int maxLines) Sets the maximum number of lines.void
setOrigin
(float startX, float startY) Sets the new text origin.void
setVerticalLayout
(float startX, float startY, float height, int maxLines, float leading) Sets the layout.protected void
Normalizes the list of chunks when the line is accepted.(package private) void
writeLine
(PdfLine line, PdfContentByte text, PdfContentByte graphics)
-
Field Details
-
NO_MORE_TEXT
public static final int NO_MORE_TEXTSignals that there are no more text available.- See Also:
-
NO_MORE_COLUMN
public static final int NO_MORE_COLUMNSignals that there is no more column.- See Also:
-
chunks
The chunks that form the text. -
text
ThePdfContent
where the text will be written to. -
alignment
protected int alignmentThe column alignment. Default is left alignment. -
currentChunkMarker
protected int currentChunkMarkerMarks the chunks to be eliminated when the line is written. -
currentStandbyChunk
The chunk created by the splitting. -
splittedChunkText
The chunk created by the splitting. -
leading
protected float leadingThe leading -
startX
protected float startXThe X coordinate. -
startY
protected float startYThe Y coordinate. -
maxLines
protected int maxLinesThe maximum number of vertical lines. -
height
protected float heightThe height of the text.
-
-
Constructor Details
-
VerticalText
Creates new VerticalText- Parameters:
text
- the place where the text will be written to. Can be a template.
-
-
Method Details
-
addText
Adds aPhrase
to the current text array.- Parameters:
phrase
- the text
-
addText
Adds aChunk
to the current text array.- Parameters:
chunk
- the text
-
setVerticalLayout
public void setVerticalLayout(float startX, float startY, float height, int maxLines, float leading) Sets the layout.- Parameters:
startX
- the top right X line positionstartY
- the top right Y line positionheight
- the height of the linesmaxLines
- the maximum number of linesleading
- the separation between the lines
-
getLeading
public float getLeading()Gets the separation between the vertical lines.- Returns:
- the vertical line separation
-
setLeading
public void setLeading(float leading) Sets the separation between the vertical lines.- Parameters:
leading
- the vertical line separation
-
createLine
Creates a line from the chunk array.- Parameters:
width
- the width of the line- Returns:
- the line or null if no more chunks
-
shortenChunkArray
protected void shortenChunkArray()Normalizes the list of chunks when the line is accepted. -
go
public int go()Outputs the lines to the document. It is equivalent togo(false)
.- Returns:
- returns the result of the operation. It can be
NO_MORE_TEXT
and/orNO_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 writing to the document- Returns:
- returns the result of the operation. It can be
NO_MORE_TEXT
and/orNO_MORE_COLUMN
-
writeLine
-
setOrigin
public void setOrigin(float startX, float startY) Sets the new text origin.- Parameters:
startX
- the X coordinatestartY
- the Y coordinate
-
getOriginX
public float getOriginX()Gets the X coordinate where the next line will be written. This value will change after each call togo()
.- Returns:
- the X coordinate
-
getOriginY
public float getOriginY()Gets the Y coordinate where the next line will be written.- Returns:
- the Y coordinate
-
getMaxLines
public int getMaxLines()Gets the maximum number of available lines. This value will change after each call togo()
.- Returns:
- Value of property maxLines.
-
setMaxLines
public void setMaxLines(int maxLines) Sets the maximum number of lines.- Parameters:
maxLines
- the maximum number of lines
-
getHeight
public float getHeight()Gets the height of the line- Returns:
- the height
-
setHeight
public void setHeight(float height) Sets the height of the line- Parameters:
height
- the new height
-
getAlignment
public int getAlignment()Gets the alignment.- Returns:
- the alignment
-
setAlignment
public void setAlignment(int alignment) Sets the alignment.- Parameters:
alignment
- the alignment
-