Top Description Fields Constructors Methods
org.apache.pdfbox.examples.util

public Class PrintTextLocations

extends PDFTextStripper
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .File, .IOException, .OutputStreamWriter, .Writer, java.util.List, org.apache.pdfbox.Loader, org.apache.pdfbox.pdmodel.PDDocument, org.apache.pdfbox.text.PDFTextStripper, .TextPosition

This is an example on how to get some x/y coordinates of text.
Author
Ben Litchfield

Field Summary

Inherited from org.apache.pdfbox.text.PDFTextStripper:
charactersByArticledocumentLINE_SEPARATORoutput

Constructor Summary

AccessConstructor and Description
public
PrintTextLocations()

Instantiate a new PDFTextStripper object.

Method Summary

Modifier and TypeMethod and Description
public static void
main(String[]
The command line arguments.
args
)

This will print the documents data.

private static void
usage()

This will print the usage for this document.

protected void
writeString(String
The text to write to the stream.
string
,
List<TextPosition>
The TextPositions belonging to the text.
textPositions
)

Overrides org.apache.pdfbox.text.PDFTextStripper.writeString.

Override the default functionality of PDFTextStripper.

Inherited from org.apache.pdfbox.text.PDFTextStripper:
beginMarkedContentSequenceendArticleendDocumentendMarkedContentSequenceendPagegetAddMoreFormattinggetArticleEndgetArticleStartgetAverageCharTolerancegetCharactersByArticlegetCurrentPageNogetDropThresholdgetEndBookmarkgetEndPagegetIgnoreContentStreamSpaceGlyphsgetIndentThresholdgetLineSeparatorgetListItemPatternsgetOutputgetPageEndgetPageStartgetParagraphEndgetParagraphStartgetSeparateByBeadsgetSortByPositiongetSpacingTolerancegetStartBookmarkgetStartPagegetSuppressDuplicateOverlappingTextgetTextgetWordSeparatormatchPatternprocessPageprocessPagesprocessTextPositionsetAddMoreFormattingsetArticleEndsetArticleStartsetAverageCharTolerancesetDropThresholdsetEndBookmarksetEndPagesetIgnoreContentStreamSpaceGlyphssetIndentThresholdsetLineSeparatorsetListItemPatternssetPageEndsetPageStartsetParagraphEndsetParagraphStartsetShouldSeparateByBeadssetSortByPositionsetSpacingTolerancesetStartBookmarksetStartPagesetSuppressDuplicateOverlappingTextsetWordSeparatorstartArticlestartArticlestartDocumentstartPagewriteCharacterswriteLineSeparatorwritePagewritePageEndwritePageStartwriteParagraphEndwriteParagraphSeparatorwriteParagraphStartwriteStringwriteTextwriteWordSeparator

Constructor Detail

PrintTextLocationsback to summary
public PrintTextLocations() throws IOException

Instantiate a new PDFTextStripper object.

Exceptions
IOException:
If there is an error loading the properties.

Method Detail

mainback to summary
public static void main(String[] args) throws IOException

This will print the documents data.

Parameters
args:String[]

The command line arguments.

Exceptions
IOException:
If there is an error parsing the document.
usageback to summary
private static void usage()

This will print the usage for this document.

writeStringback to summary
protected void writeString(String string, List<TextPosition> textPositions) throws IOException

Overrides org.apache.pdfbox.text.PDFTextStripper.writeString.

Override the default functionality of PDFTextStripper.

Parameters
string:String

Doc from org.apache.pdfbox.text.PDFTextStripper.writeString.

The text to write to the stream.

textPositions:List<TextPosition>

Doc from org.apache.pdfbox.text.PDFTextStripper.writeString.

The TextPositions belonging to the text.

Annotations
@Override
Exceptions
IOException:

Doc from org.apache.pdfbox.text.PDFTextStripper.writeString.

If there is an error when writing the text.