org.apache.pdfbox.examples.util
Class PrintTextLocations

java.lang.Object
  extended by org.apache.pdfbox.util.PDFStreamEngine
      extended by org.apache.pdfbox.util.PDFTextStripper
          extended by org.apache.pdfbox.examples.util.PrintTextLocations

public class PrintTextLocations
extends PDFTextStripper

This is an example on how to get some x/y coordinates of text. Usage: java org.apache.pdfbox.examples.util.PrintTextLocations <input-pdf>

Version:
$Revision: 1.7 $
Author:
Ben Litchfield

Field Summary
 
Fields inherited from class org.apache.pdfbox.util.PDFTextStripper
charactersByArticle, document, lineSeparator, output, outputEncoding
 
Constructor Summary
PrintTextLocations()
          Default constructor.
 
Method Summary
static void main(String[] args)
          This will print the documents data.
protected  void processTextPosition(TextPosition text)
          A method provided as an event interface to allow a subclass to perform some specific functionality when text needs to be processed.
 
Methods inherited from class org.apache.pdfbox.util.PDFTextStripper
endArticle, endDocument, endPage, getAverageCharTolerance, getCharactersByArticle, getCurrentPageNo, getEndBookmark, getEndPage, getLineSeparator, getOutput, getPageSeparator, getSpacingTolerance, getStartBookmark, getStartPage, getText, getText, getWordSeparator, inspectFontEncoding, processPage, processPages, resetEngine, setAverageCharTolerance, setEndBookmark, setEndPage, setLineSeparator, setPageSeparator, setShouldSeparateByBeads, setSortByPosition, setSpacingTolerance, setStartBookmark, setStartPage, setSuppressDuplicateOverlappingText, setWordSeparator, shouldSeparateByBeads, shouldSortByPosition, shouldSuppressDuplicateOverlappingText, startArticle, startArticle, startDocument, startPage, writeCharacters, writeLineSeparator, writePage, writePageSeperator, writeString, writeText, writeText, writeWordSeparator
 
Methods inherited from class org.apache.pdfbox.util.PDFStreamEngine
getColorSpaces, getCurrentPage, getFonts, getGraphicsStack, getGraphicsState, getGraphicsStates, getResources, getTextLineMatrix, getTextMatrix, getTotalCharCnt, getValidCharCnt, getXObjects, processEncodedText, processOperator, processOperator, processStream, processSubStream, registerOperatorProcessor, setColorSpaces, setFonts, setGraphicsStack, setGraphicsState, setGraphicsStates, setTextLineMatrix, setTextMatrix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrintTextLocations

public PrintTextLocations()
                   throws IOException
Default constructor.

Throws:
IOException - If there is an error loading text stripper properties.
Method Detail

main

public static void main(String[] args)
                 throws Exception
This will print the documents data.

Parameters:
args - The command line arguments.
Throws:
Exception - If there is an error parsing the document.

processTextPosition

protected void processTextPosition(TextPosition text)
A method provided as an event interface to allow a subclass to perform some specific functionality when text needs to be processed.

Overrides:
processTextPosition in class PDFTextStripper
Parameters:
text - The text to be processed


Copyright © 2002-2010 The Apache Software Foundation. All Rights Reserved.