pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilad Denneboom <gilad.denneb...@gmail.com>
Subject Re: Multiple instances of the same field name
Date Fri, 18 Mar 2016 15:12:30 GMT
Yeah, getWidgets also works, in the versions it's implemented. Glad to hear
you got it to work!

On Fri, Mar 18, 2016 at 3:40 PM, Kevin Ternes <KTernes@thegeneral.com>
wrote:

> 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:gilad.denneboom@gmail.com]
> Sent: Thursday, March 17, 2016 1:19 PM
> To: users@pdfbox.apache.org
> 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 <KTernes@thegeneral.com>
> 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: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message