Class TextSelection.Range

  • Enclosing class:

    public abstract static class TextSelection.Range
    extends Object
    A Range represents a selected range of PageExtractor.Text items. The range may only cover a single page
    • Constructor Detail

      • Range

        public Range()
    • Method Detail

      • getPage

        public PDFPage getPage()
        Return the PDFPage this range object relates to.
      • getFirstPosition

        public abstract int getFirstPosition()
        Return offset into the Text item returned by getFirst() that begins the selection.
      • getLastPosition

        public abstract int getLastPosition()
        Return offset into the Text item returned by getLast() that ends the selection. Note this is the offset of the last selected character, not the first unselected character.
      • getText

        public StringBuffer getText()
        Return the text this Range covers
      • getStyledText

        public AttributedString getStyledText()
        Return the text this Range covers
      • isValid

        public abstract boolean isValid()
        Return true if this Range is valid, false otherwise
      • createRange

        public static TextSelection.Range createRange​(PageExtractor.Text first,
                                                      int firstposition,
                                                      PageExtractor.Text last,
                                                      int lastposition)
        Create a new Range that covers the range of text from first character firstposition. to last character lastposition inclusive.
        first - the first text
        firstposition - the offset into the first text to start at
        last - the last text
        lastposition - the offset into the last text to end at