idx = pdf.GetCharIndexAtPos(id, page, x, y[, xt, yt])
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.