Top Description Inners Fields Constructors Methods
org.apache.pdfbox.pdmodel.interactive.form

pack-priv Class PlainText

extends Object
Class Inheritance
Imports
java.io.IOException, java.text.AttributedString, .BreakIterator, .AttributedCharacterIterator.Attribute, java.util.ArrayList, .List, org.apache.pdfbox.pdmodel.font.PDFont

A block of text.

A block of text can contain multiple paragraphs which will be treated individually within the block placement.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
PlainText.Line

An individual line of text.

pack-priv static class
PlainText.Paragraph

A block of text to be formatted as a whole.

pack-priv static class
PlainText.TextAttribute

Attribute keys and attribute values used for text handling.

pack-priv static class
PlainText.Word

An individual word.

Field Summary

Modifier and TypeField and Description
private static final float
private final List<PlainText.Paragraph>

Constructor Summary

AccessConstructor and Description
pack-priv
PlainText(String
the text block string.
textValue
)

Construct the text block from a single value.

pack-priv
PlainText(List<String>
the text block string.
listValue
)

Construct the text block from a list of values.

Method Summary

Modifier and TypeMethod and Description
pack-priv List<PlainText.Paragraph>

Returns:

the paragraphs.
getParagraphs
()

Get the list of paragraphs.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FONTSCALEback to summary
private static final float FONTSCALE
paragraphsback to summary
private final List<PlainText.Paragraph> paragraphs

Constructor Detail

PlainTextback to summary
pack-priv PlainText(String textValue)

Construct the text block from a single value. Constructs the text block from a single value splitting into individual Paragraph when a new line character is encountered.

Parameters
textValue:String

the text block string.

PlainTextback to summary
pack-priv PlainText(List<String> listValue)

Construct the text block from a list of values. Constructs the text block from a list of values treating each entry as an individual Paragraph.

Parameters
listValue:List<String>

the text block string.

Method Detail

getParagraphsback to summary
pack-priv List<PlainText.Paragraph> getParagraphs()

Get the list of paragraphs.

Returns:List<PlainText.Paragraph>

the paragraphs.

org.apache.pdfbox.pdmodel.interactive.form back to summary

pack-priv Class PlainText.Line

extends Object
Class Inheritance

An individual line of text.

Field Summary

Modifier and TypeField and Description
private float
private final List<PlainText.Word>

Constructor Summary

AccessConstructor and Description
pack-priv
Line()

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv float
calculateWidth(PDFont font, float fontSize)

pack-priv float
getInterWordSpacing(float width)

pack-priv float
pack-priv List<PlainText.Word>
pack-priv void
setWidth(float width)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lineWidthback to summary
private float lineWidth
wordsback to summary
private final List<PlainText.Word> words

Constructor Detail

Lineback to summary
pack-priv Line()

Method Detail

addWordback to summary
pack-priv void addWord(PlainText.Word word)
calculateWidthback to summary
pack-priv float calculateWidth(PDFont font, float fontSize) throws IOException
getInterWordSpacingback to summary
pack-priv float getInterWordSpacing(float width)
getWidthback to summary
pack-priv float getWidth()
getWordsback to summary
pack-priv List<PlainText.Word> getWords()
setWidthback to summary
pack-priv void setWidth(float width)
org.apache.pdfbox.pdmodel.interactive.form back to summary

pack-priv Class PlainText.Paragraph

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.pdfbox.pdmodel.interactive.form.PlainText.Paragraph

A block of text to be formatted as a whole.

A block of text can contain multiple paragraphs which will be treated individually within the block placement.

Field Summary

Modifier and TypeField and Description
private final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv List<PlainText.Line>

Returns:

the individual lines.
getLines
(PDFont
the font used for rendering the text.
font
,
float
the fontSize used for rendering the text.
fontSize
,
float
the width of the box holding the content.
width
)

Break the paragraph into individual lines.

pack-priv String

Returns:

the text.
getText
()

Get the paragraph text.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

textContentback to summary
private final String textContent

Constructor Detail

Paragraphback to summary
pack-priv Paragraph(String text)

Method Detail

getLinesback to summary
pack-priv List<PlainText.Line> getLines(PDFont font, float fontSize, float width) throws IOException

Break the paragraph into individual lines.

Parameters
font:PDFont

the font used for rendering the text.

fontSize:float

the fontSize used for rendering the text.

width:float

the width of the box holding the content.

Returns:List<PlainText.Line>

the individual lines.

getTextback to summary
pack-priv String getText()

Get the paragraph text.

Returns:String

the text.

org.apache.pdfbox.pdmodel.interactive.form back to summary

pack-priv Class PlainText.TextAttribute

extends Attribute
Class Inheritance

Attribute keys and attribute values used for text handling. This is similar to java.awt.font.TextAttribute but handled individually as to avoid a dependency on awt.

Field Summary

Modifier and TypeField and Description
private static final long
public static final AttributedCharacterIterator.Attribute
WIDTH

Attribute width of the text.

Inherited from java.text.AttributedCharacterIterator.Attribute:
INPUT_METHOD_SEGMENTLANGUAGEREADING

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Inherited from java.text.AttributedCharacterIterator.Attribute:
equalsgetNamehashCodereadResolvetoString

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.text.AttributedCharacterIterator.Attribute.serialVersionUID.

UID for serializing.

WIDTHback to summary
public static final AttributedCharacterIterator.Attribute WIDTH

Attribute width of the text.

Constructor Detail

TextAttributeback to summary
protected TextAttribute(String name)
org.apache.pdfbox.pdmodel.interactive.form back to summary

pack-priv Class PlainText.Word

extends Object
Class Inheritance

An individual word. A word is defined as a string which must be kept on the same line.

Field Summary

Modifier and TypeField and Description
private AttributedString
private final String

Constructor Summary

AccessConstructor and Description
pack-priv
Word(String text)

Method Summary

Modifier and TypeMethod and Description
pack-priv AttributedString
pack-priv String
pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributedStringback to summary
private AttributedString attributedString
textContentback to summary
private final String textContent

Constructor Detail

Wordback to summary
pack-priv Word(String text)

Method Detail

getAttributesback to summary
pack-priv AttributedString getAttributes()
getTextback to summary
pack-priv String getText()
setAttributesback to summary
pack-priv void setAttributes(AttributedString as)