Class PdfLine
- java.lang.Object
-
- com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfLine
-
public class PdfLine extends java.lang.Object
PdfLine
defines an array withPdfChunk
-objects that fit into 1 line.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
alignment
The alignment of the line.protected float
height
The heigth of the line.protected boolean
isRTL
protected float
left
The left indentation of the line.protected java.util.ArrayList
line
The arraylist containing the chunks.protected PdfChunk
listSymbol
The listsymbol (if necessary).protected boolean
newlineSplit
true
if the chunk splitting was caused by a newline.protected float
originalWidth
The original width.protected float
symbolIndent
The listsymbol (if necessary).protected float
width
The width of the line.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) PdfChunk
add(PdfChunk chunk)
Adds aPdfChunk
to thePdfLine
.float
getAscender()
Gets the maximum size of the ascender for all the fonts used in this line.PdfChunk
getChunk(int idx)
Gets aPdfChunk
by index.float
getDescender()
Gets the biggest descender for all the fonts used in this line.int
getLastStrokeChunk()
Gets the index of the lastPdfChunk
with metric attributes(package private) float
getMaxSize()
Gets the maximum size of all the fonts used in this line including images (if there are images in the line and if the leading has to be changed).(package private) float
getMaxSizeSimple()
Gets the maximum size of all the fonts used in this line including images.float
getOriginalWidth()
Gets the original width of the line.float
getWidthCorrected(float charSpacing, float wordSpacing)
Gets a width corrected with a charSpacing and wordSpacing.boolean
hasToBeJustified()
Checks if this line has to be justified.(package private) float
height()
Returns the height of the line.(package private) float
indentLeft()
Returns the left indentation of the line taking the alignment of the line into account.boolean
isNewlineSplit()
Checks if a newline caused the line split.(package private) boolean
isRTL()
java.util.Iterator
iterator()
Returns an iterator ofPdfChunk
s.float
listIndent()
Return the indentation needed to show the listsymbol.PdfChunk
listSymbol()
Returns the listsymbol of this line.(package private) int
numberOfSpaces()
Returns the number of space-characters in this line.void
resetAlignment()
Resets the alignment of this line.void
setListItem(ListItem listItem)
Sets the listsymbol of this line.int
size()
Returns the number of chunks in the line.java.lang.String
toString()
Get the string representation of what is in this line.(package private) float
widthLeft()
Returns the width that is left, after a maximum of characters is added to the line.
-
-
-
Field Detail
-
line
protected java.util.ArrayList line
The arraylist containing the chunks.
-
left
protected float left
The left indentation of the line.
-
width
protected float width
The width of the line.
-
alignment
protected int alignment
The alignment of the line.
-
height
protected float height
The heigth of the line.
-
listSymbol
protected PdfChunk listSymbol
The listsymbol (if necessary).
-
symbolIndent
protected float symbolIndent
The listsymbol (if necessary).
-
newlineSplit
protected boolean newlineSplit
true
if the chunk splitting was caused by a newline.
-
originalWidth
protected float originalWidth
The original width.
-
isRTL
protected boolean isRTL
-
-
Constructor Detail
-
PdfLine
PdfLine(float left, float right, int alignment, float height)
Constructs a newPdfLine
-object.- Parameters:
left
- the limit of the line at the leftright
- the limit of the line at the rightalignment
- the alignment of the lineheight
- the height of the line
-
PdfLine
PdfLine(float left, float remainingWidth, int alignment, boolean newlineSplit, java.util.ArrayList line, boolean isRTL)
-
-
Method Detail
-
add
PdfChunk add(PdfChunk chunk)
Adds aPdfChunk
to thePdfLine
.- Parameters:
chunk
- thePdfChunk
to add- Returns:
null
if the chunk could be added completely; if not aPdfChunk
containing the part of the chunk that could not be added is returned
-
size
public int size()
Returns the number of chunks in the line.- Returns:
- a value
-
iterator
public java.util.Iterator iterator()
Returns an iterator ofPdfChunk
s.- Returns:
- an
Iterator
-
height
float height()
Returns the height of the line.- Returns:
- a value
-
indentLeft
float indentLeft()
Returns the left indentation of the line taking the alignment of the line into account.- Returns:
- a value
-
hasToBeJustified
public boolean hasToBeJustified()
Checks if this line has to be justified.- Returns:
true
if the alignment equals ALIGN_JUSTIFIED and there is some width left.
-
resetAlignment
public void resetAlignment()
Resets the alignment of this line.The alignment of the last line of for instance a
Paragraph
that has to be justified, has to be reset to ALIGN_LEFT.
-
widthLeft
float widthLeft()
Returns the width that is left, after a maximum of characters is added to the line.- Returns:
- a value
-
numberOfSpaces
int numberOfSpaces()
Returns the number of space-characters in this line.- Returns:
- a value
-
setListItem
public void setListItem(ListItem listItem)
Sets the listsymbol of this line.This is only necessary for the first line of a
ListItem
.- Parameters:
listItem
- the list symbol
-
listSymbol
public PdfChunk listSymbol()
Returns the listsymbol of this line.- Returns:
- a
PdfChunk
if the line has a listsymbol;null
otherwise
-
listIndent
public float listIndent()
Return the indentation needed to show the listsymbol.- Returns:
- a value
-
toString
public java.lang.String toString()
Get the string representation of what is in this line.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a
String
-
isNewlineSplit
public boolean isNewlineSplit()
Checks if a newline caused the line split.- Returns:
true
if a newline caused the line split
-
getLastStrokeChunk
public int getLastStrokeChunk()
Gets the index of the lastPdfChunk
with metric attributes- Returns:
- the last
PdfChunk
with metric attributes
-
getChunk
public PdfChunk getChunk(int idx)
Gets aPdfChunk
by index.- Parameters:
idx
- the index- Returns:
- the
PdfChunk
or null if beyond the array
-
getOriginalWidth
public float getOriginalWidth()
Gets the original width of the line.- Returns:
- the original width of the line
-
getMaxSize
float getMaxSize()
Gets the maximum size of all the fonts used in this line including images (if there are images in the line and if the leading has to be changed).- Returns:
- maximum size of all the fonts used in this line
-
getMaxSizeSimple
float getMaxSizeSimple()
Gets the maximum size of all the fonts used in this line including images.- Returns:
- maximum size of all the fonts used in this line
-
isRTL
boolean isRTL()
-
getWidthCorrected
public float getWidthCorrected(float charSpacing, float wordSpacing)
Gets a width corrected with a charSpacing and wordSpacing.- Parameters:
charSpacing
-wordSpacing
-- Returns:
- a corrected width
-
getAscender
public float getAscender()
Gets the maximum size of the ascender for all the fonts used in this line.- Returns:
- maximum size of all the ascenders used in this line
-
getDescender
public float getDescender()
Gets the biggest descender for all the fonts used in this line. Note that this is a negative number.- Returns:
- maximum size of all the ascenders used in this line
-
-