| Modifier and Type | Class and Description |
|---|---|
| private static class | PDFTextStripper.
internal marker class. |
| private static class | PDFTextStripper.
wrapper of TextPosition that adds flags to track status as linestart and paragraph start positions. |
| private static class | PDFTextStripper.
Internal class that maps strings to lists of |
| Modifier and Type | Field and Description |
|---|---|
| private String | |
| private boolean | |
| private String | |
| private String | |
| private float | |
| private List | |
| private final Map | |
| protected ArrayList | charactersByArticle
The charactersByArticle is used to extract text by article divisions. |
| private final Deque | |
| private int | |
| private static float | |
| private static float | |
| protected PDDocument | |
| private float | |
| private static final float | |
| private PDOutlineItem | |
| private int | |
| private int | |
| private static final float | |
| private boolean | |
| private boolean | |
| private float | |
| private boolean | inParagraph
True if we started a paragraph but haven't ended it yet. |
| private static final float | |
| protected static final String | LINE_SEPARATOR
The platform's line separator. |
| private String | |
| private static final String[] | LIST_ITEM_EXPRESSIONS
a list of regular expressions that match commonly used list item formats, i.e. bullets, numbers, letters, Roman numerals, etc. Not meant to be comprehensive. |
| private List | |
| private static final Log | |
| private static final float | |
| private static final float | |
| private static final float | |
| private static final Map | |
| protected Writer | |
| private String | |
| private String | |
| private String | |
| private String | |
| private boolean | |
| private boolean | |
| private float | |
| private PDOutlineItem | |
| private int | |
| private int | |
| private boolean | |
| private String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | beginMarkedContentSequence(COSName
indicates the role or significance of the sequence tag, COSDictionary optional properties properties)Overrides org. Called when a marked content group begins |
| private PDFTextStripper. | createWord(String word, List<TextPosition> wordPositions)
Used within |
| protected void | |
| protected void | endDocument(PDDocument
The PDF document that is being processed. document)This method is available for subclasses of this class. |
| public void | endMarkedContentSequence()
Overrides org. Called when a marked content group ends |
| protected void | |
| private void | |
| public boolean | Returns: true if some more text formatting will be addedThis will tell if the text stripper should add some more text formatting. |
| public String | Returns: the article end stringReturns the string which will be used at the end of an article. |
| public String | Returns: the article start stringReturns the string which will be used at the beginning of an article. |
| public float | Returns: The current tolerance / scaling factorGet the current character width-based tolerance value that is being used to estimate where spaces in text should be added. |
| protected List | Returns: A double List of TextPositions for all text strings on the page.Character strings are grouped by articles. |
| protected int | Returns: A 1 based number representing the current page.Get the current page number that is being processed. |
| public float | Returns: the character height multiple for max allowed whitespace between lines in the same paragraph.the minimum whitespace, as a multiple of the max height of the current characters beyond which the current line start is considered to be a paragraph start. |
| public PDOutlineItem | Returns: The ending bookmark.Get the bookmark where text extraction should end, inclusive. |
| public int | |
| public boolean | Returns: true is space glyphs in the content stream text rendering instructions will be ignored - default is falseDetermines whether spaces in the content stream text rendering instructions will be ignored during text extraction. |
| public float | Returns: the number of whitespace character widths to use when detecting paragraph indents.returns the multiple of whitespace character widths for the current text which the current line start can be indented from the previous line start beyond which the current line start is considered to be a paragraph start. |
| public String | |
| protected List | Returns: a list of Pattern objects.returns a list of regular expression Patterns representing different common list item formats. |
| protected Writer | Returns: The stream that output is being written to.The output stream that is being written to. |
| public String | |
| public String | Returns: the page start stringReturns the string which will be used at the beginning of a page. |
| public String | Returns: the paragraph end stringReturns the string which will be used at the end of a paragraph. |
| public String | Returns: the paragraph start stringReturns the string which will be used at the beginning of a paragraph. |
| public boolean | Returns: If the text will be grouped by beads.This will tell if the text stripper should separate by beads. |
| public boolean | Returns: true If the text tokens will be sorted before being written.This will tell if the text stripper should sort the text tokens before writing to the stream. |
| public float | Returns: The current tolerance / scaling factorGet the current space width-based tolerance value that is being used to estimate where spaces in text should be added. |
| public PDOutlineItem | Returns: The starting bookmark.Get the bookmark where text extraction should start, inclusive. |
| public int | Returns: Value of property startPage.This is the page that the text extraction will start on. |
| public boolean | |
| public String | Returns: The text of the PDF document.The document to get the text from. doc)This will return the text of a document. |
| public String | |
| private String | Returns: new word with the correct direction of the containing charactersThe word that shall be processed word)Handles the LTR and RTL direction of the given words. |
| private PDFTextStripper. | Returns: start position of the last linethe current text position current,the previous text position lastPosition,the last text position that followed a line separator. lastLineStartPosition,max height for positions since lastLineStartPosition maxHeightForLine)handles the line separator for a new line given the specified current and previous TextPositions. |
| private void | isParagraphSeparation(PDFTextStripper.
the current text position. This may have its isParagraphStart or isHangingIndent flags set upon
return. position,the previous text position (should not be null). lastPosition,the last text position that followed a line separator, or null. lastLineStartPosition,max height for text positions since lasLineStartPosition. maxHeightForLine)tests the relationship between the last text position, the current text position and the last text position that followed a line separator to decide if the gap represents a paragraph separation. |
| private Pattern | Returns: the matching patternposition pwreturns the list item Pattern object that matches the text at the specified PositionWrapper or null if the text does not match such a pattern. |
| protected static Pattern | Returns: matching patternthe string to be searched string, List<Pattern> list of patterns patterns)iterates over the specified list of Patterns until it finds one that matches the specified string. |
| private float | |
| private List | Returns: a list of strings, one string for every wordlist of TextPositions lineNormalize the given list of TextPositions. |
| private StringBuilder | Returns: The StringBuilder that must be used when calling this method.Used within |
| private String | Returns: Normalized wordWord to normalize word)Normalize certain Unicode characters. |
| private boolean | |
| private static void | parseBidiFile(InputStream
- The bidi file as inputstream inputStream)This method parses the bidi file provided as inputstream. |
| public void | processPage(PDPage
The page to process. page)Overrides org. This will process the contents of a page. |
| protected void | processPages(PDPageTree
The pages object in the document. pages)This will process all of the pages and the text that is in them. |
| protected void | processTextPosition(TextPosition
The text to process. text)Overrides org. This will process a TextPosition object and add the text to the list of characters on a page. |
| private void | removeContainedSpaces(List<TextPosition> textList)
Remove all space characters if contained within the adjacent letters |
| private void | |
| public void | setAddMoreFormatting(boolean
Tell PDFBox to add some more text formatting newAddMoreFormatting)There will some additional text formatting be added if addMoreFormatting is set to true. |
| public void | setArticleEnd(String
the article end string articleEndValue)Sets the string which will be used at the end of an article. |
| public void | setArticleStart(String
the article start string articleStartValue)Sets the string which will be used at the beginning of an article. |
| public void | setAverageCharTolerance(float
average tolerance / scaling factor to use averageCharToleranceValue)Set the character width-based tolerance value that is used to estimate where spaces in text should be added. |
| public void | setDropThreshold(float
the character height multiple for max allowed whitespace between lines in the same
paragraph. dropThresholdValue)sets the minimum whitespace, as a multiple of the max height of the current characters beyond which the current line start is considered to be a paragraph start. |
| public void | setEndBookmark(PDOutlineItem
The ending bookmark. aEndBookmark)Set the bookmark where the text extraction should stop. |
| public void | setEndPage(int
New value of 1-based endPage property. endPageValue)This will set the last page to be extracted by this class. |
| public void | setIgnoreContentStreamSpaceGlyphs(boolean
whether PDF Box should ignore context stream spaces newIgnoreContentStreamSpaceGlyphs)Instruct the algorithm to ignore any spaces in the text rendering instructions in the content stream, and instead rely purely on the algorithm to determine where word breaks are. |
| public void | setIndentThreshold(float
the number of whitespace character widths to use when detecting paragraph indents. indentThresholdValue)sets the multiple of whitespace character widths for the current text which the current line start can be indented from the previous line start beyond which the current line start is considered to be a paragraph start. |
| public void | setLineSeparator(String
The desired line separator string. separator)Set the desired line separator for output text. |
| protected void | setListItemPatterns(List<Pattern>
list of patterns patterns)use to supply a different set of regular expression patterns for matching list item starts. |
| public void | setPageEnd(String
the page end string pageEndValue)Sets the string which will be used at the end of a page. |
| public void | setPageStart(String
the page start string pageStartValue)Sets the string which will be used at the beginning of a page. |
| public void | setParagraphEnd(String
the paragraph end string s)Sets the string which will be used at the end of a paragraph. |
| public void | setParagraphStart(String
the paragraph start string s)Sets the string which will be used at the beginning of a paragraph. |
| public void | setShouldSeparateByBeads(boolean
The new grouping of beads. aShouldSeparateByBeads)Set if the text stripper should group the text output by a list of beads. |
| public void | setSortByPosition(boolean
Tell PDFBox to sort the text positions. newSortByPosition)The order of the text tokens in a PDF file may not be in the same as they appear visually on the screen. |
| public void | setSpacingTolerance(float
tolerance / scaling factor to use spacingToleranceValue)Set the space width-based tolerance value that is used to estimate where spaces in text should be added. |
| public void | setStartBookmark(PDOutlineItem
The starting bookmark. aStartBookmark)Set the bookmark where text extraction should start, inclusive. |
| public void | setStartPage(int
New value of 1-based startPage property. startPageValue)This will set the first page to be extracted by this class. |
| public void | setSuppressDuplicateOverlappingText(boolean
The suppressDuplicateOverlappingText to set. suppressDuplicateOverlappingTextValue)By default the text stripper will attempt to remove text that overlapps each other. |
| public void | setWordSeparator(String
The desired page separator string. separator)Set the desired word separator for output text. |
| protected void | startArticle()
Start a new article, which is typically defined as a column on a single page (also referred to as a bead). |
| protected void | startArticle(boolean
true if primary direction of text is left to right. isLTR)Start a new article, which is typically defined as a column on a single page (also referred to as a bead). |
| protected void | startDocument(PDDocument
The PDF document that is being processed. document)This method is available for subclasses of this class. |
| protected void | |
| private boolean | within(float
The first number to compare to. first, float The second number to compare to. second, float The allowed variance. variance)This will determine of two floating point numbers are within a specified variance. |
| protected void | writeCharacters(TextPosition
The text to write to the stream. text)Write the string in TextPosition to the output stream. |
| private void | writeLine(List<PDFTextStripper.
a list with the words of the given line lineWrite a list of string containing a whole line of a document. |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| protected void | writeString(String
The text to write to the stream. text, List<TextPosition> The TextPositions belonging to the text. textPositions)Write a Java string to the output stream. |
| protected void | |
| public void | writeText(PDDocument
The document to get the data from. doc, Writer The location to put the text. outputStream)This will take a PDDocument and write the text of that document to the print writer. |
| protected void |