Thank you! Here is an implementation of Gilad's advice:
PDField pdField = pdAcroForm.getField("EffectiveDate");
List<PDAnnotationWidget> widgetList = pdField.getWidgets();
for (PDAnnotationWidget widget : widgetList) {
PDRectangle r = widget.getRectangle();
log.info(" - rectangle: llx={}, lly={}, w={}, h={}", r.getLowerLeftX(),
r.getLowerLeftY(), r.getWidth(), r.getHeight());
}
-----Original Message-----
From: Gilad Denneboom [mailto:[email protected]]
Sent: Thursday, March 17, 2016 1:19 PM
To: [email protected]
Subject: Re: Multiple instances of the same field name
The "#0" is not a part of the actual field name, it's just a convention used by
Acrobat to show that the field has more than one widgets. To access these
widgets using PDFBox you can use the getKids method of PDField.
On Thu, Mar 17, 2016 at 5:26 PM, Kevin Ternes <[email protected]>
wrote:
> How do I deal with incoming PDFs that appear to have more than one
> field with the same name?
> When I open the doc with Acrobat, I see fields "EffectiveDate#0" and
> "EffectiveDate#1".
> I am trying to manipulate the position/width/height of the two fields,
> #0 and #1, independently.
>
> But when I use PDFBox,
> PDField pdField0 = pdAcroForm.getField("EffectiveDate");
> I get an instance and I can get/set the field value.
>
> But...
> PDField pdField0 = pdAcroForm.getField("EffectiveDate#0");
> returns NULL.
>
> I am not allowed to change the names of the fields. Otherwise, I
> would change them to EffectiveDate_0 and EffectiveDate_1.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]