Class Paragraph
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.ArrayList
com.gitlab.pdftk_java.com.lowagie.text.Phrase
com.gitlab.pdftk_java.com.lowagie.text.Paragraph
- All Implemented Interfaces:
Element, MarkupAttributes, TextElementArray, Serializable, Cloneable, Iterable, Collection, List, RandomAccess, SequencedCollection
- Direct Known Subclasses:
ListItem
A
Paragraph is a series of Chunks and/or Phrases.
A Paragraph has the same qualities of a Phrase, but also
some additional layout-parameters:
- the indentation
- the alignment of the text
Paragraph p = new Paragraph("This is a paragraph",
FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0, 255)));
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe alignment of the text.private floatHolds value of property extraParagraphSpace.private floatHolds value of property firstLineIndent.protected floatThe indentation of this paragraph on the left side.protected floatThe indentation of this paragraph on the right side.protected booleanDoes the paragraph has to be kept together on 1 page.protected floatThe text leading that is multiplied by the biggest font size in the line.private static final longA serial version UIDprotected floatThe spacing after the paragraph.protected floatThe spacing before the paragraph.Fields inherited from class Phrase
font, leading, markupAttributesFields inherited from class AbstractList
modCountFields inherited from interface 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, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, GRAPHIC, HEADER, IMGRAW, IMGTEMPLATE, JPEG, KEYWORDS, LIST, LISTITEM, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE -
Constructor Summary
ConstructorsConstructorDescriptionConstructs aParagraph.Paragraph(float leading) Constructs aParagraphwith a certain leading.Constructs aParagraphwith a certainChunkand a certain leading.Constructs aParagraphwith a certainStringand a certain leading.Constructs aParagraphwith a certain leading,StringandFont.Constructs aParagraphwith a certainChunk.Constructs aParagraphwith a certainPhrase.Constructs aParagraphwith a certainString.Constructs aParagraphwith a certainStringand a certainFont.Paragraph(Properties attributes) Returns aParagraphthat has been constructed taking in account the value of some attributes. -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds anObjectto theParagraph.intGets the alignment of this paragraph.floatGetter for property extraParagraphSpace.floatGetter for property firstLineIndent.booleanChecks if this paragraph has to be kept together on one page.floatGets the variable leadingfloatGets the indentation of this paragraph on the left side.floatGets the indentation of this paragraph on the right side.static booleanChecks if a given tag corresponds with this object.voidsetAlignment(int alignment) Sets the alignment of this paragraph.voidsetAlignment(String alignment) Sets the alignment of this paragraph.voidsetExtraParagraphSpace(float extraParagraphSpace) Setter for property extraParagraphSpace.voidsetFirstLineIndent(float firstLineIndent) Setter for property firstLineIndent.voidsetIndentationLeft(float indentation) Sets the indentation of this paragraph on the left side.voidsetIndentationRight(float indentation) Sets the indentation of this paragraph on the right side.voidsetKeepTogether(boolean keeptogether) Indicates that the paragraph has to be kept together on one page.voidsetLeading(float fixedLeading) Sets the leading of this phrase.voidsetLeading(float fixedLeading, float multipliedLeading) Sets the leading fixed and variable.voidsetSpacingAfter(float spacing) Sets the spacing after this paragraph.voidsetSpacingBefore(float spacing) Sets the spacing before this paragraph.floatGets the spacing before this paragraph.floatGets the spacing before this paragraph.inttype()Gets the type of the text element.Methods inherited from class Phrase
add, addAll, addSpecial, font, getChunks, getInstance, getInstance, getInstance, getMarkupAttribute, getMarkupAttributeNames, getMarkupAttributes, isEmpty, leading, leadingDefined, process, setMarkupAttribute, setMarkupAttributesMethods inherited from class ArrayList
addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class AbstractCollection
containsAll, toStringMethods inherited from interface Collection
parallelStream, stream, toArrayMethods inherited from interface List
containsAll, reversedMethods inherited from interface MarkupAttributes
getMarkupAttribute, getMarkupAttributeNames, getMarkupAttributes, setMarkupAttribute, setMarkupAttributes
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDA serial version UID- See Also:
-
alignment
protected int alignmentThe alignment of the text. -
indentationLeft
protected float indentationLeftThe indentation of this paragraph on the left side. -
indentationRight
protected float indentationRightThe indentation of this paragraph on the right side. -
spacingBefore
protected float spacingBeforeThe spacing before the paragraph. -
spacingAfter
protected float spacingAfterThe spacing after the paragraph. -
keeptogether
protected boolean keeptogetherDoes the paragraph has to be kept together on 1 page. -
multipliedLeading
protected float multipliedLeadingThe text leading that is multiplied by the biggest font size in the line. -
firstLineIndent
private float firstLineIndentHolds value of property firstLineIndent. -
extraParagraphSpace
private float extraParagraphSpaceHolds value of property extraParagraphSpace.
-
-
Constructor Details
-
Paragraph
public Paragraph()Constructs aParagraph. -
Paragraph
public Paragraph(float leading) Constructs aParagraphwith a certain leading.- Parameters:
leading- the leading
-
Paragraph
Constructs aParagraphwith a certainChunk.- Parameters:
chunk- aChunk
-
Paragraph
Constructs aParagraphwith a certainChunkand a certain leading.- Parameters:
leading- the leadingchunk- aChunk
-
Paragraph
Constructs aParagraphwith a certainString.- Parameters:
string- aString
-
Paragraph
-
Paragraph
Constructs aParagraphwith a certainStringand a certain leading.- Parameters:
leading- the leadingstring- aString
-
Paragraph
-
Paragraph
Constructs aParagraphwith a certainPhrase.- Parameters:
phrase- aPhrase
-
Paragraph
Returns aParagraphthat has been constructed taking in account the value of some attributes.- Parameters:
attributes- Some attributes
-
-
Method Details
-
type
-
add
Adds anObjectto theParagraph.- Specified by:
addin interfaceCollection- Specified by:
addin interfaceList- Specified by:
addin interfaceTextElementArray- Overrides:
addin classPhrase- Parameters:
o- object the object to add.- Returns:
- true is adding the object succeeded
-
setAlignment
public void setAlignment(int alignment) Sets the alignment of this paragraph.- Parameters:
alignment- the new alignment
-
setAlignment
Sets the alignment of this paragraph.- Parameters:
alignment- the new alignment as aString
-
setIndentationLeft
public void setIndentationLeft(float indentation) Sets the indentation of this paragraph on the left side.- Parameters:
indentation- the new indentation
-
setIndentationRight
public void setIndentationRight(float indentation) Sets the indentation of this paragraph on the right side.- Parameters:
indentation- the new indentation
-
setSpacingBefore
public void setSpacingBefore(float spacing) Sets the spacing before this paragraph.- Parameters:
spacing- the new spacing
-
setSpacingAfter
public void setSpacingAfter(float spacing) Sets the spacing after this paragraph.- Parameters:
spacing- the new spacing
-
setKeepTogether
public void setKeepTogether(boolean keeptogether) Indicates that the paragraph has to be kept together on one page.- Parameters:
keeptogether- true of the paragraph may not be split over 2 pages
-
getKeepTogether
public boolean getKeepTogether()Checks if this paragraph has to be kept together on one page.- Returns:
- true if the paragraph may not be split over 2 pages.
-
alignment
public int alignment()Gets the alignment of this paragraph.- Returns:
- alignment
-
indentationLeft
public float indentationLeft()Gets the indentation of this paragraph on the left side.- Returns:
- the indentation
-
indentationRight
public float indentationRight()Gets the indentation of this paragraph on the right side.- Returns:
- the indentation
-
spacingBefore
public float spacingBefore()Gets the spacing before this paragraph.- Returns:
- the spacing
-
spacingAfter
public float spacingAfter()Gets the spacing before this paragraph.- Returns:
- the spacing
-
isTag
Checks if a given tag corresponds with this object.- Parameters:
tag- the given tag- Returns:
- true if the tag corresponds
-
setLeading
public void setLeading(float fixedLeading, float multipliedLeading) Sets the leading fixed and variable. The resultant leading will be fixedLeading+multipliedLeading*maxFontSize where maxFontSize is the size of the bigest font in the line.- Parameters:
fixedLeading- the fixed leadingmultipliedLeading- the variable leading
-
setLeading
public void setLeading(float fixedLeading) Description copied from class:PhraseSets the leading of this phrase.- Overrides:
setLeadingin classPhrase- Parameters:
fixedLeading- the new leading- See Also:
-
getMultipliedLeading
public float getMultipliedLeading()Gets the variable leading- Returns:
- the leading
-
getFirstLineIndent
public float getFirstLineIndent()Getter for property firstLineIndent.- Returns:
- Value of property firstLineIndent.
-
setFirstLineIndent
public void setFirstLineIndent(float firstLineIndent) Setter for property firstLineIndent.- Parameters:
firstLineIndent- New value of property firstLineIndent.
-
getExtraParagraphSpace
public float getExtraParagraphSpace()Getter for property extraParagraphSpace.- Returns:
- Value of property extraParagraphSpace.
-
setExtraParagraphSpace
public void setExtraParagraphSpace(float extraParagraphSpace) Setter for property extraParagraphSpace.- Parameters:
extraParagraphSpace- New value of property extraParagraphSpace.
-