Package com.storedobject.pdf
Class PDF.Text
- All Implemented Interfaces:
StyledBuilder
,Serializable
,Cloneable
,Iterable<PDFElement>
,Collection<PDFElement>
,List<PDFElement>
,RandomAccess
,SequencedCollection<PDFElement>
- Enclosing class:
PDF
Used to define text to include in the PDF document.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.storedobject.common.StyledBuilder
StyledBuilder.Style
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
Fields inherited from interface com.storedobject.common.StyledBuilder
EMPTY_STRINGS
-
Constructor Summary
ConstructorsConstructorDescriptionText()
Creates an empty text string.Text
(int fontSize) Creates a text string from the object.Text
(int fontSize, int fontStyle) Creates a text string from the object.Create a text string from the chunk.Creates a text string from the object.Creates a text string from the object.Creates a text string from the object.Creates a text string from the object.Creates a text string from the object.Creates a text string from the object. -
Method Summary
Modifier and TypeMethodDescriptionappend
(int fontSize) Appends a font to this text.append
(int fontSize, int fontStyle) Appends a font to this text.Appends another chunk to this text.Appends a color to this text.Appends a font to this text.Appends a color to this text.Appends text from the objectAppends a font to this text.Appends a font to this text.Appends text from the objectAppends text from the objectAppends text from the objectAppends a color to this text.Clear contentboolean
empty()
Checks if empty or not.boolean
Check if the last add was a new line or not.newLine()
Append a new line.newLine
(boolean forceIt) Append a new line.Resets the font to the default.Methods inherited from class com.storedobject.pdf.PDFPhrase
add, getChunks, getFont, getInstance, getLeading, setFont, setLeading
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
Methods inherited from class java.util.AbstractCollection
containsAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods inherited from interface java.util.List
containsAll, reversed
-
Constructor Details
-
Text
public Text()Creates an empty text string. -
Text
Creates a text string from the object.- Parameters:
text
- Object to be converted to text.
-
Text
-
Text
Creates a text string from the object.- Parameters:
text
- Object to be converted to text.fontSize
- Font size.
-
Text
Creates a text string from the object.- Parameters:
text
- Object to be converted to text.fontSize
- Font size.fontStyle
- Style of the font to be appended (PDFFont.BOLD, PDFFont.ITALIC etc.)
-
Text
public Text(int fontSize) Creates a text string from the object.- Parameters:
fontSize
- Font size.
-
Text
public Text(int fontSize, int fontStyle) Creates a text string from the object.- Parameters:
fontSize
- Font size.fontStyle
- Style of the font to be appended (PDFFont.BOLD, PDFFont.ITALIC etc.)
-
Text
-
Text
-
Text
Create a text string from the chunk.- Parameters:
chunk
- Chunk from which the text is created. Font of this chunk is also accepted.
-
-
Method Details
-
append
-
append
-
append
-
append
Appends a color to this text. This color will be used for further texts added.- Specified by:
append
in interfaceStyledBuilder
- Parameters:
object
- Object to append.color
- Color to be appended- Returns:
- This
-
append
Appends a font to this text. This font will be used for further texts added.- Parameters:
fontSize
- Point size of the font to be appended- Returns:
- This
-
append
Appends a font to this text. This font will be used for further texts added.- Parameters:
fontSize
- Point size of the font to be appendedfontStyle
- Style of the font to be appended (PDFFont.BOLD, PDFFont.ITALIC etc.)- Returns:
- This
-
append
-
append
Appends a font to this text. This font will be used for further texts added.- Parameters:
text
- Text to be appended.fontSize
- Point size of the font to be appendedfontStyle
- Style of the font to be appended (PDFFont.BOLD, PDFFont.ITALIC etc.)- Returns:
- This
-
append
-
append
Appends text from the object- Specified by:
append
in interfaceStyledBuilder
- Parameters:
text
- Object to be converted to text.- Returns:
- This
-
append
-
append
-
append
-
newLine
Append a new line. It will not be forced if we are already on a new line- Specified by:
newLine
in interfaceStyledBuilder
- Returns:
- This
-
newLine
Append a new line.- Specified by:
newLine
in interfaceStyledBuilder
- Parameters:
forceIt
- Force the new line.- Returns:
- This
-
isNewLine
public boolean isNewLine()Description copied from interface:StyledBuilder
Check if the last add was a new line or not.- Specified by:
isNewLine
in interfaceStyledBuilder
- Returns:
- True/false
-
empty
public boolean empty()Checks if empty or not.- Returns:
- True or false.
-
resetFont
-
clearContent
Clear content- Specified by:
clearContent
in interfaceStyledBuilder
- Returns:
- this
-