I want to generate the coordinates of each line so I can use them in the Highlight annotation:

I want to iterate one after another line and highlight them. How can I achieve this?
I also wanna add another question which is, can I trigger a function on line click? For example I click on line 100 in whole pdf, and it triggers a function returning 100 (The index of the line in whole pdf).