Hi,

I've been trying to highlight a specific field in my pdf but can only get it to work with the setQuads method and not with the setRectangle method (which would be much nicer then manually recording the quad points of the rectangle).  Could somebody help clarify what I'm doing incorrectly?

    PDField pdfield = pdf.getField(field);
    List<PDAnnotationWidget> widgets = pdfield.getWidgets();

    for (PDAnnotationWidget widget : widgets) {

      PDPage page = widget.getPage();
      PDRectangle rectangle = widget.getRectangle();

      // Use info to instantiate approriate highlight box and add to page
      PDAnnotationHighlight idAnnotation = new PDAnnotationHighlight();
      idAnnotation.setColor(new PDColor(new float[] { 0, 0, 1 }, PDDeviceRGB.INSTANCE));
      idAnnotation.setConstantOpacity((float) 0.3);
      idAnnotation.setRectangle(rectangle);
      page.getAnnotations().add(idAnnotation);
    }
  }

best,

jake


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to