public class Paragraph extends TextFlow implements Drawable, Element, WidthRespecting, Dividable
text that is drawn as
one element. A paragraph has a (text-)
alignment, and respects a given width by applying
word-wrap.Dividable.DividedDEFAULT_LINE_SPACING| Constructor and Description |
|---|
Paragraph() |
| Modifier and Type | Method and Description |
|---|---|
protected Paragraph |
createInstance() |
Dividable.Divided |
divide(float remainingHeight,
float pageHeight)
Divides the drawable vetically into pieces where the first part is to
respect the given remaining height.
|
void |
draw(org.apache.pdfbox.pdmodel.PDDocument pdDocument,
org.apache.pdfbox.pdmodel.PDPageContentStream contentStream,
Position upperLeft,
DrawListener drawListener)
Draws the object at the given position.
|
Position |
getAbsolutePosition()
If an absolute position is given, the drawable will be drawn at this
position ignoring any
Layout. |
Alignment |
getAlignment() |
Paragraph |
removeLeadingEmptyLines() |
Paragraph |
removeLeadingEmptyVerticalSpace() |
void |
setAbsolutePosition(Position absolutePosition)
Sets the absolute position to render at.
|
void |
setAlignment(Alignment alignment)
Sets the alignment to apply.
|
add, add, addMarkup, addMarkup, addText, drawText, drawTextRightAligned, getHeight, getLast, getLineSpacing, getMaxWidth, getWidth, isApplyLineSpacingToFirstLine, isEmpty, iterator, removeLast, setApplyLineSpacingToFirstLine, setLineSpacing, setMaxWidth, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetMaxWidth, setMaxWidthforEach, spliteratorpublic Position getAbsolutePosition()
DrawableLayout.getAbsolutePosition in interface Drawablepublic void setAbsolutePosition(Position absolutePosition)
absolutePosition - the absolute position.public Alignment getAlignment()
public void setAlignment(Alignment alignment)
alignment - the text alignment.public void draw(org.apache.pdfbox.pdmodel.PDDocument pdDocument,
org.apache.pdfbox.pdmodel.PDPageContentStream contentStream,
Position upperLeft,
DrawListener drawListener)
throws IOException
Drawabledraw in interface DrawablepdDocument - the underlying pdfbox document.contentStream - the stream to draw to.upperLeft - the upper left position to start drawing.drawListener - the listener to
notify on
drawn objects.IOException - by pdfboxpublic Dividable.Divided divide(float remainingHeight, float pageHeight) throws IOException
Dividabledivide in interface DividableremainingHeight - the remaining height on the page dictating the height of the
first part.pageHeight - the height of the next page allows to make better decisions on
how to divide best, e.g. maybe the element fits completely on
the next page.IOException - by pdfbox.public Paragraph removeLeadingEmptyVerticalSpace() throws IOException
removeLeadingEmptyVerticalSpace in interface DrawableIOException - by pdfboxpublic Paragraph removeLeadingEmptyLines() throws IOException
removeLeadingEmptyLines in class TextFlowNewLines are removed.IOException - by pdfbox.protected Paragraph createInstance()
createInstance in class TextFlowCopyright © 2021. All rights reserved.