This is what I came up with after spelunking in the PDField's dictionary:
public Rectangle2D.Float getOutline(PDField field)
{
FDFAnnotationPolygon annotation = new
FDFAnnotationPolygon(field.getDictionary());
PDRectangle rectangle = annotation.getRectangle();
float lowerLeftX = rectangle.getLowerLeftX();
float lowerLeftY = rectangle.getLowerLeftY();
float width = rectangle.getWidth();
float height = rectangle.getHeight();
return new Rectangle2D.Float(lowerLeftX, lowerLeftY, width, height);
}
Not sure whether that's the proper way of doing it, or whether there is an
easier way.
My next question is: in a multi-page document, how do I determine on which
page a particular field is?
Thanks for any hints,
Mirko