Package org.apache.pdfbox.tools
Class PDFText2HTML.FontState
java.lang.Object
org.apache.pdfbox.tools.PDFText2HTML.FontState
- Enclosing class:
- PDFText2HTML
A helper class to maintain the current font state. It's public methods will emit opening and
closing tags as needed, and in the correct order.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclear()
Closes all open states.private String
private String
private int
closeUntil
(StringBuilder tagsBuilder, String endTag) private boolean
isBold
(PDFontDescriptor descriptor) private boolean
isItalic
(PDFontDescriptor descriptor) private String
private String
protected String
push
(StringBuilder buffer, char character, TextPosition textPosition) push
(String text, List<TextPosition> textPositions) Pushes newTextPositions
into the font state.
-
Field Details
-
stateList
-
stateSet
-
-
Constructor Details
-
FontState
private FontState()
-
-
Method Details
-
push
Pushes newTextPositions
into the font state. The state is only preserved correctly for each letter if the number of letters intext
matches the number ofTextPosition
objects. Otherwise, it's done once for the complete array (just by looking at its first entry).- Returns:
- A string that contains the text including tag changes caused by its font state.
-
clear
Closes all open states.- Returns:
- A string that contains the closing tags of all currently open states.
-
push
-
open
-
close
-
closeUntil
-
openTag
-
closeTag
-
isBold
-
isItalic
-