Class PlainTextFormatter
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.interactive.annotation.layout.PlainTextFormatter
-
public class PlainTextFormatter extends java.lang.Object
TextFormatter to handle plain text formatting for annotation rectangles. 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 static class
PlainTextFormatter.Builder
(package private) static class
PlainTextFormatter.TextAlign
-
Field Summary
Fields Modifier and Type Field Description private AppearanceStyle
appearanceStyle
private PDAppearanceContentStream
contents
private static int
FONTSCALE
The scaling factor for font units to PDF unitsprivate float
horizontalOffset
private PlainTextFormatter.TextAlign
textAlignment
private PlainText
textContent
private float
verticalOffset
private float
width
private boolean
wrapLines
-
Constructor Summary
Constructors Modifier Constructor Description private
PlainTextFormatter(PlainTextFormatter.Builder builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
format()
Format the text block.private void
processLines(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.IOException
Format 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.
-
-