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 Stringprivate Stringprivate intcloseUntil(StringBuilder tagsBuilder, String endTag) private booleanisBold(PDFontDescriptor descriptor) private booleanisItalic(PDFontDescriptor descriptor) private Stringprivate Stringprotected Stringpush(StringBuilder buffer, char character, TextPosition textPosition) push(String text, List<TextPosition> textPositions) Pushes newTextPositionsinto the font state.
-
Field Details
-
stateList
-
stateSet
-
-
Constructor Details
-
FontState
private FontState()
-
-
Method Details
-
push
Pushes newTextPositionsinto the font state. The state is only preserved correctly for each letter if the number of letters intextmatches the number ofTextPositionobjects. 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
-