Home » pdfbox-1.1.0-src » org.apache.pdfbox.util » [javadoc | source]
org.apache.pdfbox.util
public class: TextPosition [javadoc | source]
java.lang.Object
   org.apache.pdfbox.util.TextPosition
This represents a string and a position on the screen of those characters.
Constructor:
 protected TextPosition() 
 public TextPosition(PDPage page,
    Matrix textPositionSt,
    Matrix textPositionEnd,
    float maxFontH,
    float[] individualWidths,
    float spaceWidth,
    String string,
    PDFont currentFont,
    float fontSizeValue,
    int fontSizeInPt,
    float ws) 
    Constructor.
    Parameters:
    page - Page that the text is located in
    textPositionSt - TextMatrix for start of text (in display units)
    textPositionEnd - TextMatrix for end of text (in display units)
    maxFontH - Maximum height of text (in display units)
    individualWidths - The width of each individual character. (in ? units)
    spaceWidth - The width of the space character. (in display units)
    string - The character to be displayed.
    currentFont - The current for for this text position.
    fontSizeValue - The new font size.
    fontSizeInPt - The font size in pt units.
    ws - The word spacing parameter (in display units)
Method from org.apache.pdfbox.util.TextPosition Summary:
contains,   getCharacter,   getDir,   getFont,   getFontSize,   getFontSizeInPt,   getHeight,   getHeightDir,   getIndividualWidths,   getTextPos,   getWidth,   getWidthDirAdj,   getWidthOfSpace,   getWordSpacing,   getX,   getXDirAdj,   getXScale,   getY,   getYDirAdj,   getYScale,   isDiacritic,   mergeDiacritic,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.pdfbox.util.TextPosition Detail:
 public boolean contains(TextPosition tp2) 
    Determine if this TextPosition logically contains another (i.e. they overlap and should be rendered on top of each other).
 public String getCharacter() 
    Return the string of characters stored in this object.
 public float getDir() 
    Return the direction/orientation of the string in this object based on its text matrix.
 public PDFont getFont() 
    This will get the font for the text being drawn.
 public float getFontSize() 
    This will get the font size that this object is suppose to be drawn at.
 public float getFontSizeInPt() 
    This will get the font size in pt. To get this size we have to multiply the pdf-fontsize and the scaling from the textmatrix
 public float getHeight() 
    This will get the maximum height of all characters in this string.
 public float getHeightDir() 
    This will get the maximum height of all characters in this string.
 public float[] getIndividualWidths() 
    Get the widths of each individual character.
 public Matrix getTextPos() 
    Return the Matrix textPos stored in this object.
 public float getWidth() 
    This will get the width of the string when page rotation adjusted coordinates are used.
 public float getWidthDirAdj() 
    This will get the width of the string when text direction adjusted coordinates are used.
 public float getWidthOfSpace() 
    This will get the width of a space character. This is useful for some algorithms such as the text stripper, that need to know the width of a space character.
 public float getWordSpacing() 
    This will get the current word spacing.
 public float getX() 
    This will get the page rotation adjusted x position of the character. This is adjusted based on page rotation so that the upper left is 0,0.
 public float getXDirAdj() 
    This will get the text direction adjusted x position of the character. This is adjusted based on text direction so that the first character in that direction is in the upper left at 0,0.
 public float getXScale() 
 public float getY() 
    This will get the y position of the text, adjusted so that 0,0 is upper left and it is adjusted based on the page rotation.
 public float getYDirAdj() 
    This will get the y position of the text, adjusted so that 0,0 is upper left and it is adjusted based on the text direction.
 public float getYScale() 
 public boolean isDiacritic() 
 public  void mergeDiacritic(TextPosition diacritic,
    TextNormalize normalize) 
    Merge a single character TextPosition into the current object. This is to be used only for cases where we have a diacritic that overlaps an existing TextPosition. In a graphical display, we could overlay them, but for text extraction we need to merge them. Use the contains() method to test if two objects overlap.
 public String toString() 
    Show the string data for this text position.