-
- All Implemented Interfaces:
-
java.io.Closeable,java.lang.AutoCloseable
public final class PdfTextPage implements Closeable
Represents a text page extracted from a PDF page.
Create instances using PdfPage.openTextPage. Always call close when done to release native resources.
-
-
Method Summary
Modifier and Type Method Description final IntegergetCharCount()final StringgetText()final StringextractText(Integer startIndex, Integer count)Extract text from the specified range. final DoubleArraygetCharBox(Integer index)Get the bounding box of a character at the specified index. final IntegergetIndexAtPos(Double x, Double y, Double xTolerance, Double yTolerance)Get the index of the character at the specified point (x, y). final List<PdfTextSearchMatch>search(String query, Boolean matchCase, Boolean matchWholeWord)Search for text on the page. final List<RectF>getTextRects(Integer startIndex, Integer count)Get the bounding rectangles for a range of text. Unitclose()final PdfWebLinksloadWebLinks()Scan the page for web links. -
-
Method Detail
-
getCharCount
final Integer getCharCount()
-
extractText
final String extractText(Integer startIndex, Integer count)
Extract text from the specified range.
- Parameters:
startIndex- Start index (0-based)count- Number of characters to extract
-
getCharBox
final DoubleArray getCharBox(Integer index)
Get the bounding box of a character at the specified index. Returns left, top, right, bottom.
-
getIndexAtPos
final Integer getIndexAtPos(Double x, Double y, Double xTolerance, Double yTolerance)
Get the index of the character at the specified point (x, y).
- Parameters:
x- X-coordinatey- Y-coordinatexTolerance- Horizontal toleranceyTolerance- Vertical tolerance
-
search
final List<PdfTextSearchMatch> search(String query, Boolean matchCase, Boolean matchWholeWord)
Search for text on the page.
- Parameters:
query- The text to search formatchCase- Whether to match casematchWholeWord- Whether to match whole words
-
getTextRects
final List<RectF> getTextRects(Integer startIndex, Integer count)
Get the bounding rectangles for a range of text. Handles multi-line text by returning multiple rectangles.
-
loadWebLinks
final PdfWebLinks loadWebLinks()
Scan the page for web links.
-
-
-
-