Coordinates of formfields

Help
Leitender
2011-12-28
2013-05-28
  • Leitender
    Leitender
    2011-12-28

    Hello,

    I want to know the coordinates of  formfields like radiobuttons, checkboxes or textfields.

    I use this way at the moment

    public void test(PDAcroFormField formfield){

    final List<?> annotations = formfield.getAnnotations();

            for (final Object obj : annotations) {
                if (obj instanceof PDAnnotation) {
                    final de.intarsys.pdf.pd.PDAnnotation annotation = (PDAnnotation) obj;
                    final CDSRectangle rec = annotation.getRectangle();
    rec.getHeight();
    rec.getWidth();
    rec.getLowerLeftX();
    rec.getLowerLeftY();
    }
    }
    }

    Is this the correct way?

     
  • Leitender
    Leitender
    2011-12-28

    Sorry I forgot:

    What are the return values of

    rec.getHeight();
    rec.getWidth();
    rec.getLowerLeftX();
    rec.getLowerLeftY();

    Px? Pt?

     

  • Anonymous
    2011-12-28

    This is the correct way to get the annotations rectangle. You may want to take into account that a form field may have mutliple annotations on DIFFERENT PAGES.

    The coordinate system for the rectangle is the same as the page boxes etc. - PDF user space. This defaults to 1/72 inch, but may be overridden. For detailed information consult PDF spec, chapter 4.2.

     
  • Leitender
    Leitender
    2011-12-29

    Thank you very much.