[
https://issues.apache.org/jira/browse/PDFBOX-2980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14900931#comment-14900931
]
Maruan Sahyoun commented on PDFBOX-2980:
----------------------------------------
I looked at it in a little more detail and this is how it worked in the past
prior to 1.8.9. When kids were treated as PDFields the old code changed the
underlying COSDictionary from a pure PDAnnotationWidget by adding PDField
related items to the COSDictionary. Now also this might be beneficial for some
uses cases it's not for others as the original PDField now became a non
terminal field and the field definition is beyond the users control.
If there are fields to be added I suggest that this is done explicitly and not
behind the scenes although I understand that you might have counted on the old
(wrong) behavior.
{quote}
but {{page_num}} needs to be filled with individual pages
{quote}
For that to work each {{page_num}} field has to be an individual field as
otherwise they do share the same value. What you could do, if you need to make
the field a set of individual ones is to (roughly)
- iterate the PDAnnotationWidgets
- get the COSDictionary
- create a new PDField with the COSDictionary and the original field as parent
- set an individual field name
> PDField.getKids doesn't return PDFields since 1.8.9
> ---------------------------------------------------
>
> Key: PDFBOX-2980
> URL: https://issues.apache.org/jira/browse/PDFBOX-2980
> Project: PDFBox
> Issue Type: Bug
> Components: AcroForm
> Affects Versions: 1.8.9, 1.8.10
> Environment: $ cat /proc/version
> Linux version 3.19.0-28-generic (buildd@lgw01-03) (gcc version 4.9.2 (Ubuntu
> 4.9.2-10ubuntu13) ) #30-Ubuntu SMP Mon Aug 31 15:52:51 UTC 2015
> $ java -version
> java version "1.7.0_79"
> OpenJDK Runtime Environment (IcedTea 2.5.6) (7u79-2.5.6-0ubuntu1.15.04.1)
> OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
> Reporter: Johannes Barre
> Attachments: Field.java
>
>
> For my current task I need to access several form fields with the same name.
> I found [PDFBOX-2148], which seemed to be exactly what I need. However, when
> I tried the code and pdf of that bug with Pdfbox 1.8.10, I got no output,
> because {{getKids}} returned {{PDAnnotationWidget}} s instead of {{PDField}}
> s, even when I tried the provided code. So I tried with 1.8.5 (reported
> version) and I got this output:
> {noformat}
> Button2.null
> Button2.null
> Button2.null
> Button2.null
> {noformat}
> With 1.8.8 I've got:
> {noformat}
> Button2
> Button2
> Button2
> Button2
> {noformat}
> And with 1.8.9 and 1.8.10 I got no output at all.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]