Btw here is the relevant code I currently use:
pdfView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
try {
for (PageIterator itr = doc.getPageIterator(); itr.hasNext(); )
{
Page page = (Page)(itr.next());
int num_annots = page.getNumAnnots();
for (int i = 0; i < num_annots; ++i)
{
Annot annot = page.getAnnot(i);
// Log.i(“annotazione”, Integer.toString((int)annot.getRect().getX1()));
// Log.v(“annotazioneType”, annot.getSDFObj().get(“Subtype”).value().getName());
if (annot.isValid() == false) continue;
if (annot.getType() == Annot.e_Widget) {
int page_num = page.getIndex();
Rect bbox = annot.getRect(); // Integer.toString((int)bbox.getY2()));
Log.i(“getX”, Integer.toString((int)event.getX()));
Log.i(“getY”, Integer.toString((int)event.getY()));
pdftron.PDF.Annots.Widget w=new pdftron.PDF.Annots.Widget(annot);
Field f = w.getField();
int this_coords[] = {0,0};
v.getLocationOnScreen(this_coords);
//Log.v(“daxh”,"onTouch_coords: “+this_coords[0]+”, "+this_coords[1]);
String name = f.getName();
// Log.v(“nome campo”, name);
if(bbox.contains((int)event.getX(), (int)event.getY())){
Log.v(“touch”, name);
}
}
}
}
}
catch (Exception e)
{
}
return false;
}
});