Class PlainTextFormatter
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.interactive.form.PlainTextFormatter
-
class PlainTextFormatter extends java.lang.ObjectTextFormatter to handle plain text formatting. The text formatter will take a single value or an array of values which are treated as paragraphs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classPlainTextFormatter.Builder(package private) static classPlainTextFormatter.TextAlign
-
Field Summary
Fields Modifier and Type Field Description private AppearanceStyleappearanceStyleprivate PDAppearanceContentStreamcontentsprivate static intFONTSCALEThe scaling factor for font units to PDF unitsprivate floathorizontalOffsetprivate PlainTextFormatter.TextAligntextAlignmentprivate PlainTexttextContentprivate floatverticalOffsetprivate floatwidthprivate booleanwrapLines
-
Constructor Summary
Constructors Modifier Constructor Description privatePlainTextFormatter(PlainTextFormatter.Builder builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidformat()Format the text block.private voidprocessLines(java.util.List<PlainText.Line> lines, boolean isFirstParagraph)Process lines for output.
-
-
-
Field Detail
-
FONTSCALE
private static final int FONTSCALE
The scaling factor for font units to PDF units- See Also:
- Constant Field Values
-
appearanceStyle
private final AppearanceStyle appearanceStyle
-
wrapLines
private final boolean wrapLines
-
width
private final float width
-
contents
private final PDAppearanceContentStream contents
-
textContent
private final PlainText textContent
-
textAlignment
private final PlainTextFormatter.TextAlign textAlignment
-
horizontalOffset
private float horizontalOffset
-
verticalOffset
private float verticalOffset
-
-
Constructor Detail
-
PlainTextFormatter
private PlainTextFormatter(PlainTextFormatter.Builder builder)
-
-
Method Detail
-
format
public void format() throws java.io.IOExceptionFormat the text block.- Throws:
java.io.IOException- if there is an error writing to the stream.
-
processLines
private void processLines(java.util.List<PlainText.Line> lines, boolean isFirstParagraph) throws java.io.IOException
Process lines for output. Process lines for an individual paragraph and generate the commands for the content stream to show the text.- Parameters:
lines- the lines to process.- Throws:
java.io.IOException- if there is an error writing to the stream.
-
-