public class Paragraph extends Phrase implements Indentable, Spaceable, IAccessibleElement
Paragraph
is a series of Chunk
s and/or Phrases
.
A Paragraph
has the same qualities of a Phrase
, but also some additional layout-parameters:
Paragraph p = new Paragraph("This is a paragraph", FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0, 255)));
Element
, Phrase
, ListItem
, Serialized Form
Modifier and Type | Field and Description |
---|---|
protected HashMap<PdfName,PdfObject> |
accessibleAttributes |
protected int |
alignment
The alignment of the text.
|
protected AccessibleElementId |
id |
protected float |
indentationLeft
The indentation of this paragraph on the left side.
|
protected float |
indentationRight
The indentation of this paragraph on the right side.
|
protected boolean |
keeptogether
Does the paragraph has to be kept together on 1 page.
|
protected float |
paddingTop |
protected PdfName |
role |
protected float |
spacingAfter
The spacing after the paragraph.
|
protected float |
spacingBefore
The spacing before the paragraph.
|
font, hyphenation, leading, multipliedLeading, tabSettings
modCount
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, BODY, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CHAPTER, CHUNK, CREATIONDATE, CREATOR, DIV, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LANGUAGE, LIST, LISTITEM, MARKED, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, SECTION, SUBJECT, TITLE, WRITABLE_DIRECT, YMARK
Constructor and Description |
---|
Paragraph()
Constructs a Paragraph .
|
Paragraph(Chunk chunk)
Constructs a Paragraph with a certain Chunk .
|
Paragraph(float leading)
Constructs a Paragraph with a certain leading.
|
Paragraph(float leading, Chunk chunk)
Constructs a Paragraph with a certain Chunk and a certain leading.
|
Paragraph(float leading, String string)
Constructs a Paragraph with a certain String and a certain leading.
|
Paragraph(float leading, String string, Font font)
Constructs a Paragraph with a certain leading, String and Font .
|
Paragraph(Phrase phrase)
Constructs a Paragraph with a certain Phrase .
|
Paragraph(String string)
Constructs a Paragraph with a certain String .
|
Paragraph(String string, Font font)
Constructs a Paragraph with a certain String and a certain Font .
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Element o)
Adds an Element to the Paragraph .
|
List<Element> |
breakUp()
Breaks this Paragraph up in different parts, separating paragraphs, lists and tables from each other.
|
Paragraph |
cloneShallow(boolean spacingBefore)
Creates a shallow clone of the Paragraph.
|
PdfObject |
getAccessibleAttribute(PdfName key)
Get the attribute of accessible element (everything in A dictionary + Lang , Alt , ActualText , E ).
|
HashMap<PdfName,PdfObject> |
getAccessibleAttributes()
Gets all the properties of accessible element.
|
int |
getAlignment()
Gets the alignment of this paragraph.
|
float |
getExtraParagraphSpace()
Getter for property extraParagraphSpace.
|
float |
getFirstLineIndent()
Getter for property firstLineIndent.
|
AccessibleElementId |
getId() |
float |
getIndentationLeft()
Gets the indentation on the left side.
|
float |
getIndentationRight()
Gets the indentation on the right side.
|
boolean |
getKeepTogether()
Checks if this paragraph has to be kept together on one page.
|
float |
getPaddingTop() |
PdfName |
getRole()
Gets the role of the accessible element.
|
float |
getSpacingAfter()
Gets the spacing after.
|
float |
getSpacingBefore()
Gets the spacing before.
|
boolean |
isInline() |
protected void |
populateProperties(Paragraph copy, boolean spacingBefore) |
void |
setAccessibleAttribute(PdfName key, PdfObject value)
Set the attribute of accessible element (everything in A dictionary + Lang , Alt , ActualText , E ).
|
void |
setAlignment(int alignment)
Sets the alignment of this paragraph.
|
void |
setExtraParagraphSpace(float extraParagraphSpace)
Setter for property extraParagraphSpace.
|
void |
setFirstLineIndent(float firstLineIndent)
Setter for property firstLineIndent.
|
void |
setId(AccessibleElementId id) |
void |
setIndentationLeft(float indentation)
Sets the indentation on the left side.
|
void |
setIndentationRight(float indentation)
Sets the indentation on the right side.
|
void |
setKeepTogether(boolean keeptogether)
Indicates that the paragraph has to be kept together on one page.
|
void |
setPaddingTop(float paddingTop) |
void |
setRole(PdfName role)
Sets the role of the accessiblee element.
|
void |
setSpacingAfter(float spacing)
Sets the spacing after.
|
void |
setSpacingBefore(float spacing)
Sets the spacing before.
|
float |
spacingAfter()
Deprecated.
As of iText 2.1.5, replaced by
getSpacingAfter() , scheduled for removal at 2.3.0
|
float |
spacingBefore()
Deprecated.
As of iText 2.1.5, replaced by
getSpacingBefore() , scheduled for removal at 2.3.0
|
int |
type()
Gets the type of the text element.
|
add, add, addAll, addChunk, addSpecial, getChunks, getContent, getFont, getHyphenation, getInstance, getInstance, getInstance, getLeading, getMultipliedLeading, getTabSettings, getTotalLeading, hasLeading, isContent, isEmpty, isNestable, process, setFont, setHyphenation, setLeading, setLeading, setMultipliedLeading, setTabSettings, trim
addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
equals, hashCode
containsAll, toString
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
containsAll, equals, hashCode
parallelStream, stream
protected int alignment
protected float indentationLeft
protected float indentationRight
protected float spacingBefore
protected float spacingAfter
protected boolean keeptogether
protected float paddingTop
protected PdfName role
protected AccessibleElementId id
public Paragraph()
Paragraph
.
public Paragraph(float leading)
Paragraph
with a certain leading.
leading
- the leading
public Paragraph(Chunk chunk)
Paragraph
with a certain Chunk
.
chunk
- a Chunk
public Paragraph(float leading, Chunk chunk)
Paragraph
with a certain Chunk
and a certain leading.
leading
- the leading
chunk
- a Chunk
public Paragraph(String string)
Paragraph
with a certain String
.
string
- a String
public Paragraph(String string, Font font)
Paragraph
with a certain String
and a certain Font
.
string
- a String
font
- a Font
public Paragraph(float leading, String string)
Paragraph
with a certain String
and a certain leading.
leading
- the leading
string
- a String
public Paragraph(float leading, String string, Font font)
Paragraph
with a certain leading, String
and Font
.
leading
- the leading
string
- a String
font
- a Font
public Paragraph(Phrase phrase)
Paragraph
with a certain Phrase
.
phrase
- a Phrase
public Paragraph cloneShallow(boolean spacingBefore)
protected void populateProperties(Paragraph copy, boolean spacingBefore)
public List<Element> breakUp()
public int type()
public boolean add(Element o)
Element
to the Paragraph
.
add
in interface TextElementArray
add
in interface Collection<Element>
add
in interface List<Element>
add
in class Phrase
o
- the element to add.
public void setAlignment(int alignment)
alignment
- the new alignment
public void setIndentationLeft(float indentation)
Indentable
setIndentationLeft
in interface Indentable
indentation
- the new indentation
public void setIndentationRight(float indentation)
Indentable
setIndentationRight
in interface Indentable
indentation
- the new indentation
public void setFirstLineIndent(float firstLineIndent)
firstLineIndent
- New value of property firstLineIndent.
public void setSpacingBefore(float spacing)
Spaceable
setSpacingBefore
in interface Spaceable
spacing
- the new spacing
public void setSpacingAfter(float spacing)
Spaceable
setSpacingAfter
in interface Spaceable
spacing
- the new spacing
public void setKeepTogether(boolean keeptogether)
keeptogether
- true of the paragraph may not be split over 2 pages
public boolean getKeepTogether()
public int getAlignment()
public float getIndentationLeft()
Indentable
getIndentationLeft
in interface Indentable
public float getIndentationRight()
Indentable
getIndentationRight
in interface Indentable
public float getFirstLineIndent()
public float getSpacingBefore()
Spaceable
getSpacingBefore
in interface Spaceable
public float getSpacingAfter()
Spaceable
getSpacingAfter
in interface Spaceable
public float getExtraParagraphSpace()
public void setExtraParagraphSpace(float extraParagraphSpace)
extraParagraphSpace
- New value of property extraParagraphSpace.
@Deprecated public float spacingBefore()
getSpacingBefore()
, scheduled for removal at 2.3.0
@Deprecated public float spacingAfter()
getSpacingAfter()
, scheduled for removal at 2.3.0
public PdfObject getAccessibleAttribute(PdfName key)
IAccessibleElement
A
dictionary + Lang
, Alt
, ActualText
, E
).
getAccessibleAttribute
in interface IAccessibleElement
public void setAccessibleAttribute(PdfName key, PdfObject value)
IAccessibleElement
A
dictionary + Lang
, Alt
, ActualText
, E
).
setAccessibleAttribute
in interface IAccessibleElement
public HashMap<PdfName,PdfObject> getAccessibleAttributes()
IAccessibleElement
getAccessibleAttributes
in interface IAccessibleElement
public PdfName getRole()
IAccessibleElement
getRole
in interface IAccessibleElement
public void setRole(PdfName role)
IAccessibleElement
null
if you don't want to tag this element. Note that all child elements won't also be tagged.
setRole
in interface IAccessibleElement
public AccessibleElementId getId()
getId
in interface IAccessibleElement
public void setId(AccessibleElementId id)
setId
in interface IAccessibleElement
public boolean isInline()
isInline
in interface IAccessibleElement
public float getPaddingTop()
getPaddingTop
in interface Spaceable
public void setPaddingTop(float paddingTop)
setPaddingTop
in interface Spaceable
Copyright © 2016. All rights reserved.