Name
pdf.GetCharIndexAtPos -- get character at page position (V1.1)
Synopsis
idx = pdf.GetCharIndexAtPos(id, page, x, y[, xt, yt])
Function
This function can be used to get the index of a character at or nearby the position specified by x and y on the page. The optional xt and yt parameters can be used to specify a tolerance value (in point units) that should be used when getting the character.

The page to use must be specified in the page argument. It must be a number in the range of 1 to the total number of pages in the document and the page must have been previously loaded using pdf.LoadPage() with the text argument set to True. The PDF document specified by id must have been previously opened using pdf.OpenDocument().

pdf.GetCharIndexAtPos() will return the zero-based index of the character at, or nearby the point specified by x and y. If there is no character at or nearby the point, the return value will be -1. If an error occurs, -3 will be returned.

Inputs
id
identifier of the PDF document to use
page
page number to use (starting from 1)
x
x position to use
y
y position to use
xt
optional: x tolerance value (defaults to 0)
yt
optional: y tolerance value (defaults to 0)
Results
idx
index of character at the specified point or -1 or -3 (see above)

Show TOC