You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Barry Neu <ba...@gmail.com> on 2016/09/09 22:15:38 UTC

PDAcroForm.getFieldIterator() Question

Hello.

The API docs for this method state an iterator is returned which "walks all fields in the field tree, in order”.
Is the order left to right, top to bottom on the form .. I was hoping?
I was hoping it was but ehe following code seems to prove otherwise.

PDDocument pdDoc = getTemplate("http://localhost:8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf <http://localhost:8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf>");
PDAcroForm pdAcroForm = pdDoc.getDocumentCatalog().getAcroForm();
Iterator<PDField> iter = pdAcroForm.getFieldIterator();
while (iter.hasNext()) {
       PDField field = iter.next();
       String fieldName = field.getPartialName();
       System.out.println("field partial name: " + fieldName );
}

PDF in question is here: 	 https://github.com/BarryNeu/shared <https://github.com/BarryNeu/shared>

Thanks in advance.
Barry


Re: PDAcroForm.getFieldIterator() Question

Posted by John Hewson <jo...@jahewson.com>.
> On 12 Sep 2016, at 12:38, Barry Neu <ba...@gmail.com> wrote:
> 
> Sure, it’s in the first email of this thread and here for convenience:
> PDF in question is here: 	 https://github.com/BarryNeu/shared <https://github.com/BarryNeu/shared>

Ah, ok, perfect. So looking at the file in PDFDebugger I see that the fields are in an arbitrary order, for example
the first six fields are:

EE FIRST NAME
EE MIDDLE NAME
EE CHANGE CERTIFICATE
EE GENDER MALE
EE GENER FEMAEL
EE ADDRESS 2

Each field does however contain a ”Rect" entry which specifies its bounds, however with complex forms like
this it’s not obvious how to map that back to an order.

Worse still, many ”fields" on the form are not Acrobat form fields at all, so you have no way to discover them.

— John

> Thank you.
> 
> 
>> On Sep 12, 2016, at 1:36 PM, John Hewson <jo...@jahewson.com> wrote:
>> 
>> 
>>> On 12 Sep 2016, at 10:17, Barry Neu <ba...@gmail.com> wrote:
>>> 
>>> I’m trying to achieve the following.
>>> Client has forms approved by U.S. states where font must be Helvetica 9pt.
>> 
>> Feel free to share a link to one of these forms and we can take a look.
>> 
>> -- John
>> 
>>> Some content to be populated on the forms does not fit in the field. In this case there is a “footnote” such as "Addendum 1" populated in the field, and the actual content for the field is populated on an addendum page merged as a separate page to the base form. The addendum page references the numbered addendum(s) populated in the base form’s fields.
>>> Ideally, Addendum 1, Addendum 2, and so on would be numbered left to right, top to bottom in the fields of the form.
>>> Sounds like that is not possible without setting up some type of external ordering of the fields on the form.
>>> 
>>> 
>>> 
>>>> On Sep 12, 2016, at 9:47 AM, Maruan Sahyoun <sa...@fileaffairs.de> wrote:
>>>> 
>>>> Hi Barry,
>>>> 
>>>> 
>>>>> Am 12.09.2016 um 17:16 schrieb Barry Neu <barry.neu@gmail.com <ma...@gmail.com>>:
>>>>> 
>>>>> Is there any way to influence the order the fields occur in the field tree when creating fillable forms or otherwise?
>>>> 
>>>> is there a specific order you are looking for? What are you trying to achieve? The order of the fields in the AcroForms fields array and the order how they are tabbed on screen when a user filled the form are not related!
>>>> 
>>>> BR
>>>> Maruan
>>>> 
>>>> 
>>>>>> On Sep 9, 2016, at 4:44 PM, John Hewson <jo...@jahewson.com> wrote:
>>>>>> 
>>>>>> 
>>>>>>> On 9 Sep 2016, at 15:15, Barry Neu <ba...@gmail.com> wrote:
>>>>>>> 
>>>>>>> Hello.
>>>>>>> 
>>>>>>> The API docs for this method state an iterator is returned which "walks all fields in the field tree, in order”.
>>>>>>> Is the order left to right, top to bottom on the form .. I was hoping?
>>>>>>> I was hoping it was but ehe following code seems to prove otherwise.
>>>>>> 
>>>>>> It's not a visual order. It's simply the order in which the fields occur in the field tree. This has no relation to where fields appear on the page.
>>>>>> 
>>>>>> -- John
>>>>>> 
>>>>>>> PDDocument pdDoc = getTemplate("http://localhost:8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf <http://localhost:8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf>");
>>>>>>> PDAcroForm pdAcroForm = pdDoc.getDocumentCatalog().getAcroForm();
>>>>>>> Iterator<PDField> iter = pdAcroForm.getFieldIterator();
>>>>>>> while (iter.hasNext()) {
>>>>>>> PDField field = iter.next();
>>>>>>> String fieldName = field.getPartialName();
>>>>>>> System.out.println("field partial name: " + fieldName );
>>>>>>> }
>>>>>>> 
>>>>>>> PDF in question is here:     https://github.com/BarryNeu/shared <https://github.com/BarryNeu/shared>
>>>>>>> 
>>>>>>> Thanks in advance.
>>>>>>> Barry
>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org <ma...@pdfbox.apache.org>
>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org <ma...@pdfbox.apache.org>
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org <ma...@pdfbox.apache.org>
>>>> For additional commands, e-mail: users-help@pdfbox.apache.org <ma...@pdfbox.apache.org>
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>> 
> 


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


Re: PDAcroForm.getFieldIterator() Question

Posted by Barry Neu <ba...@gmail.com>.
Sure, it’s in the first email of this thread and here for convenience:
PDF in question is here: 	 https://github.com/BarryNeu/shared <https://github.com/BarryNeu/shared>

Thank you.


> On Sep 12, 2016, at 1:36 PM, John Hewson <jo...@jahewson.com> wrote:
> 
> 
>> On 12 Sep 2016, at 10:17, Barry Neu <ba...@gmail.com> wrote:
>> 
>> I’m trying to achieve the following.
>> Client has forms approved by U.S. states where font must be Helvetica 9pt.
> 
> Feel free to share a link to one of these forms and we can take a look.
> 
> -- John
> 
>> Some content to be populated on the forms does not fit in the field. In this case there is a “footnote” such as "Addendum 1" populated in the field, and the actual content for the field is populated on an addendum page merged as a separate page to the base form. The addendum page references the numbered addendum(s) populated in the base form’s fields.
>> Ideally, Addendum 1, Addendum 2, and so on would be numbered left to right, top to bottom in the fields of the form.
>> Sounds like that is not possible without setting up some type of external ordering of the fields on the form.
>> 
>> 
>> 
>>> On Sep 12, 2016, at 9:47 AM, Maruan Sahyoun <sa...@fileaffairs.de> wrote:
>>> 
>>> Hi Barry,
>>> 
>>> 
>>>> Am 12.09.2016 um 17:16 schrieb Barry Neu <barry.neu@gmail.com <ma...@gmail.com>>:
>>>> 
>>>> Is there any way to influence the order the fields occur in the field tree when creating fillable forms or otherwise?
>>> 
>>> is there a specific order you are looking for? What are you trying to achieve? The order of the fields in the AcroForms fields array and the order how they are tabbed on screen when a user filled the form are not related!
>>> 
>>> BR
>>> Maruan
>>> 
>>> 
>>>>> On Sep 9, 2016, at 4:44 PM, John Hewson <jo...@jahewson.com> wrote:
>>>>> 
>>>>> 
>>>>>> On 9 Sep 2016, at 15:15, Barry Neu <ba...@gmail.com> wrote:
>>>>>> 
>>>>>> Hello.
>>>>>> 
>>>>>> The API docs for this method state an iterator is returned which "walks all fields in the field tree, in order”.
>>>>>> Is the order left to right, top to bottom on the form .. I was hoping?
>>>>>> I was hoping it was but ehe following code seems to prove otherwise.
>>>>> 
>>>>> It's not a visual order. It's simply the order in which the fields occur in the field tree. This has no relation to where fields appear on the page.
>>>>> 
>>>>> -- John
>>>>> 
>>>>>> PDDocument pdDoc = getTemplate("http://localhost:8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf <http://localhost:8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf>");
>>>>>> PDAcroForm pdAcroForm = pdDoc.getDocumentCatalog().getAcroForm();
>>>>>> Iterator<PDField> iter = pdAcroForm.getFieldIterator();
>>>>>> while (iter.hasNext()) {
>>>>>>  PDField field = iter.next();
>>>>>>  String fieldName = field.getPartialName();
>>>>>>  System.out.println("field partial name: " + fieldName );
>>>>>> }
>>>>>> 
>>>>>> PDF in question is here:     https://github.com/BarryNeu/shared <https://github.com/BarryNeu/shared>
>>>>>> 
>>>>>> Thanks in advance.
>>>>>> Barry
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org <ma...@pdfbox.apache.org>
>>>> For additional commands, e-mail: users-help@pdfbox.apache.org <ma...@pdfbox.apache.org>
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org <ma...@pdfbox.apache.org>
>>> For additional commands, e-mail: users-help@pdfbox.apache.org <ma...@pdfbox.apache.org>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
> 


Re: PDAcroForm.getFieldIterator() Question

Posted by John Hewson <jo...@jahewson.com>.
> On 12 Sep 2016, at 10:17, Barry Neu <ba...@gmail.com> wrote:
> 
> I’m trying to achieve the following.
> Client has forms approved by U.S. states where font must be Helvetica 9pt.

Feel free to share a link to one of these forms and we can take a look.

-- John

> Some content to be populated on the forms does not fit in the field. In this case there is a “footnote” such as "Addendum 1" populated in the field, and the actual content for the field is populated on an addendum page merged as a separate page to the base form. The addendum page references the numbered addendum(s) populated in the base form’s fields.
> Ideally, Addendum 1, Addendum 2, and so on would be numbered left to right, top to bottom in the fields of the form.
> Sounds like that is not possible without setting up some type of external ordering of the fields on the form.
> 
> 
> 
>> On Sep 12, 2016, at 9:47 AM, Maruan Sahyoun <sa...@fileaffairs.de> wrote:
>> 
>> Hi Barry,
>> 
>> 
>>> Am 12.09.2016 um 17:16 schrieb Barry Neu <barry.neu@gmail.com <ma...@gmail.com>>:
>>> 
>>> Is there any way to influence the order the fields occur in the field tree when creating fillable forms or otherwise?
>> 
>> is there a specific order you are looking for? What are you trying to achieve? The order of the fields in the AcroForms fields array and the order how they are tabbed on screen when a user filled the form are not related!
>> 
>> BR
>> Maruan
>> 
>> 
>>>> On Sep 9, 2016, at 4:44 PM, John Hewson <jo...@jahewson.com> wrote:
>>>> 
>>>> 
>>>>> On 9 Sep 2016, at 15:15, Barry Neu <ba...@gmail.com> wrote:
>>>>> 
>>>>> Hello.
>>>>> 
>>>>> The API docs for this method state an iterator is returned which "walks all fields in the field tree, in order”.
>>>>> Is the order left to right, top to bottom on the form .. I was hoping?
>>>>> I was hoping it was but ehe following code seems to prove otherwise.
>>>> 
>>>> It's not a visual order. It's simply the order in which the fields occur in the field tree. This has no relation to where fields appear on the page.
>>>> 
>>>> -- John
>>>> 
>>>>> PDDocument pdDoc = getTemplate("http://localhost:8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf <http://localhost:8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf>");
>>>>> PDAcroForm pdAcroForm = pdDoc.getDocumentCatalog().getAcroForm();
>>>>> Iterator<PDField> iter = pdAcroForm.getFieldIterator();
>>>>> while (iter.hasNext()) {
>>>>>   PDField field = iter.next();
>>>>>   String fieldName = field.getPartialName();
>>>>>   System.out.println("field partial name: " + fieldName );
>>>>> }
>>>>> 
>>>>> PDF in question is here:     https://github.com/BarryNeu/shared <https://github.com/BarryNeu/shared>
>>>>> 
>>>>> Thanks in advance.
>>>>> Barry
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org <ma...@pdfbox.apache.org>
>>> For additional commands, e-mail: users-help@pdfbox.apache.org <ma...@pdfbox.apache.org>
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org <ma...@pdfbox.apache.org>
>> For additional commands, e-mail: users-help@pdfbox.apache.org <ma...@pdfbox.apache.org>

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


Re: PDAcroForm.getFieldIterator() Question

Posted by Evan Williams <ev...@zapprx.com>.
I faced exactly the same issue and made a similar addendum page. I put some
time and effort into getting the field appearances using this (probably
crappy) code

*        COSDictionary fieldDict = field.getCOSObject();*
*        COSArray fieldAreaArray = (COSArray) fieldDict*
*                .getDictionaryObject(COSName.RECT);*
*        PDRectangle result = new PDRectangle(fieldAreaArray);*

Then I did the sorting myself using the coordinates of the PDRectangles.

This does not deal with things like fields having more than one appearance
and I am probably doing something just wrong but it works well enough.

In retrospect it WAS NOT WORTH THE EFFORT. But your milage may vary.

On Mon, Sep 12, 2016 at 1:17 PM, Barry Neu <ba...@gmail.com> wrote:

> I’m trying to achieve the following.
> Client has forms approved by U.S. states where font must be Helvetica 9pt.
> Some content to be populated on the forms does not fit in the field. In
> this case there is a “footnote” such as "Addendum 1" populated in the
> field, and the actual content for the field is populated on an addendum
> page merged as a separate page to the base form. The addendum page
> references the numbered addendum(s) populated in the base form’s fields.
> Ideally, Addendum 1, Addendum 2, and so on would be numbered left to
> right, top to bottom in the fields of the form.
> Sounds like that is not possible without setting up some type of external
> ordering of the fields on the form.
>
>
>
> > On Sep 12, 2016, at 9:47 AM, Maruan Sahyoun <sa...@fileaffairs.de>
> wrote:
> >
> > Hi Barry,
> >
> >
> >> Am 12.09.2016 um 17:16 schrieb Barry Neu <barry.neu@gmail.com <mailto:
> barry.neu@gmail.com>>:
> >>
> >> Is there any way to influence the order the fields occur in the field
> tree when creating fillable forms or otherwise?
> >>
> >
> > is there a specific order you are looking for? What are you trying to
> achieve? The order of the fields in the AcroForms fields array and the
> order how they are tabbed on screen when a user filled the form are not
> related!
> >
> > BR
> > Maruan
> >
> >
> >>> On Sep 9, 2016, at 4:44 PM, John Hewson <jo...@jahewson.com> wrote:
> >>>
> >>>
> >>>> On 9 Sep 2016, at 15:15, Barry Neu <ba...@gmail.com> wrote:
> >>>>
> >>>> Hello.
> >>>>
> >>>> The API docs for this method state an iterator is returned which
> "walks all fields in the field tree, in order”.
> >>>> Is the order left to right, top to bottom on the form .. I was hoping?
> >>>> I was hoping it was but ehe following code seems to prove otherwise.
> >>>
> >>> It's not a visual order. It's simply the order in which the fields
> occur in the field tree. This has no relation to where fields appear on the
> page.
> >>>
> >>> -- John
> >>>
> >>>> PDDocument pdDoc = getTemplate("http://localhost:
> 8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf <
> http://localhost:8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf>");
> >>>> PDAcroForm pdAcroForm = pdDoc.getDocumentCatalog().getAcroForm();
> >>>> Iterator<PDField> iter = pdAcroForm.getFieldIterator();
> >>>> while (iter.hasNext()) {
> >>>>    PDField field = iter.next();
> >>>>    String fieldName = field.getPartialName();
> >>>>    System.out.println("field partial name: " + fieldName );
> >>>> }
> >>>>
> >>>> PDF in question is here:     https://github.com/BarryNeu/shared <
> https://github.com/BarryNeu/shared>
> >>>>
> >>>> Thanks in advance.
> >>>> Barry
> >>>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> >>> For additional commands, e-mail: users-help@pdfbox.apache.org
> >>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org <mailto:
> users-unsubscribe@pdfbox.apache.org>
> >> For additional commands, e-mail: users-help@pdfbox.apache.org <mailto:
> users-help@pdfbox.apache.org>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org <mailto:
> users-unsubscribe@pdfbox.apache.org>
> > For additional commands, e-mail: users-help@pdfbox.apache.org <mailto:
> users-help@pdfbox.apache.org>
>



-- 
*Evan Williams*
Sr. Software Engineer
evan.williams@zapprx.com

*www.ZappRx.com <http://www.zapprx.com/>*

Re: PDAcroForm.getFieldIterator() Question

Posted by Barry Neu <ba...@gmail.com>.
I’m trying to achieve the following.
Client has forms approved by U.S. states where font must be Helvetica 9pt.
Some content to be populated on the forms does not fit in the field. In this case there is a “footnote” such as "Addendum 1" populated in the field, and the actual content for the field is populated on an addendum page merged as a separate page to the base form. The addendum page references the numbered addendum(s) populated in the base form’s fields.
Ideally, Addendum 1, Addendum 2, and so on would be numbered left to right, top to bottom in the fields of the form.
Sounds like that is not possible without setting up some type of external ordering of the fields on the form.
 


> On Sep 12, 2016, at 9:47 AM, Maruan Sahyoun <sa...@fileaffairs.de> wrote:
> 
> Hi Barry,
> 
> 
>> Am 12.09.2016 um 17:16 schrieb Barry Neu <barry.neu@gmail.com <ma...@gmail.com>>:
>> 
>> Is there any way to influence the order the fields occur in the field tree when creating fillable forms or otherwise?
>> 
> 
> is there a specific order you are looking for? What are you trying to achieve? The order of the fields in the AcroForms fields array and the order how they are tabbed on screen when a user filled the form are not related!
> 
> BR
> Maruan
> 
> 
>>> On Sep 9, 2016, at 4:44 PM, John Hewson <jo...@jahewson.com> wrote:
>>> 
>>> 
>>>> On 9 Sep 2016, at 15:15, Barry Neu <ba...@gmail.com> wrote:
>>>> 
>>>> Hello.
>>>> 
>>>> The API docs for this method state an iterator is returned which "walks all fields in the field tree, in order”.
>>>> Is the order left to right, top to bottom on the form .. I was hoping?
>>>> I was hoping it was but ehe following code seems to prove otherwise.
>>> 
>>> It's not a visual order. It's simply the order in which the fields occur in the field tree. This has no relation to where fields appear on the page.
>>> 
>>> -- John
>>> 
>>>> PDDocument pdDoc = getTemplate("http://localhost:8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf <http://localhost:8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf>");
>>>> PDAcroForm pdAcroForm = pdDoc.getDocumentCatalog().getAcroForm();
>>>> Iterator<PDField> iter = pdAcroForm.getFieldIterator();
>>>> while (iter.hasNext()) {
>>>>    PDField field = iter.next();
>>>>    String fieldName = field.getPartialName();
>>>>    System.out.println("field partial name: " + fieldName );
>>>> }
>>>> 
>>>> PDF in question is here:     https://github.com/BarryNeu/shared <https://github.com/BarryNeu/shared>
>>>> 
>>>> Thanks in advance.
>>>> Barry
>>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org <ma...@pdfbox.apache.org>
>> For additional commands, e-mail: users-help@pdfbox.apache.org <ma...@pdfbox.apache.org>
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org <ma...@pdfbox.apache.org>
> For additional commands, e-mail: users-help@pdfbox.apache.org <ma...@pdfbox.apache.org>

Re: PDAcroForm.getFieldIterator() Question

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
Hi Barry,


> Am 12.09.2016 um 17:16 schrieb Barry Neu <ba...@gmail.com>:
> 
> Is there any way to influence the order the fields occur in the field tree when creating fillable forms or otherwise?
> 

is there a specific order you are looking for? What are you trying to achieve? The order of the fields in the AcroForms fields array and the order how they are tabbed on screen when a user filled the form are not related!

BR
Maruan


>> On Sep 9, 2016, at 4:44 PM, John Hewson <jo...@jahewson.com> wrote:
>> 
>> 
>>> On 9 Sep 2016, at 15:15, Barry Neu <ba...@gmail.com> wrote:
>>> 
>>> Hello.
>>> 
>>> The API docs for this method state an iterator is returned which "walks all fields in the field tree, in order”.
>>> Is the order left to right, top to bottom on the form .. I was hoping?
>>> I was hoping it was but ehe following code seems to prove otherwise.
>> 
>> It's not a visual order. It's simply the order in which the fields occur in the field tree. This has no relation to where fields appear on the page.
>> 
>> -- John
>> 
>>> PDDocument pdDoc = getTemplate("http://localhost:8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf <http://localhost:8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf>");
>>> PDAcroForm pdAcroForm = pdDoc.getDocumentCatalog().getAcroForm();
>>> Iterator<PDField> iter = pdAcroForm.getFieldIterator();
>>> while (iter.hasNext()) {
>>>     PDField field = iter.next();
>>>     String fieldName = field.getPartialName();
>>>     System.out.println("field partial name: " + fieldName );
>>> }
>>> 
>>> PDF in question is here:     https://github.com/BarryNeu/shared <https://github.com/BarryNeu/shared>
>>> 
>>> Thanks in advance.
>>> Barry
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
> 


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


Re: PDAcroForm.getFieldIterator() Question

Posted by Barry Neu <ba...@gmail.com>.
Is there any way to influence the order the fields occur in the field tree when creating fillable forms or otherwise?

> On Sep 9, 2016, at 4:44 PM, John Hewson <jo...@jahewson.com> wrote:
> 
> 
>> On 9 Sep 2016, at 15:15, Barry Neu <ba...@gmail.com> wrote:
>> 
>> Hello.
>> 
>> The API docs for this method state an iterator is returned which "walks all fields in the field tree, in order”.
>> Is the order left to right, top to bottom on the form .. I was hoping?
>> I was hoping it was but ehe following code seems to prove otherwise.
> 
> It's not a visual order. It's simply the order in which the fields occur in the field tree. This has no relation to where fields appear on the page.
> 
> -- John
> 
>> PDDocument pdDoc = getTemplate("http://localhost:8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf <http://localhost:8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf>");
>> PDAcroForm pdAcroForm = pdDoc.getDocumentCatalog().getAcroForm();
>> Iterator<PDField> iter = pdAcroForm.getFieldIterator();
>> while (iter.hasNext()) {
>>      PDField field = iter.next();
>>      String fieldName = field.getPartialName();
>>      System.out.println("field partial name: " + fieldName );
>> }
>> 
>> PDF in question is here:     https://github.com/BarryNeu/shared <https://github.com/BarryNeu/shared>
>> 
>> Thanks in advance.
>> Barry
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
> 


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


Re: PDAcroForm.getFieldIterator() Question

Posted by John Hewson <jo...@jahewson.com>.
> On 9 Sep 2016, at 15:15, Barry Neu <ba...@gmail.com> wrote:
> 
> Hello.
> 
> The API docs for this method state an iterator is returned which "walks all fields in the field tree, in order”.
> Is the order left to right, top to bottom on the form .. I was hoping?
> I was hoping it was but ehe following code seems to prove otherwise.

It's not a visual order. It's simply the order in which the fields occur in the field tree. This has no relation to where fields appear on the page.

-- John

> PDDocument pdDoc = getTemplate("http://localhost:8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf <http://localhost:8000/template/Template_MA_ABJ4580MAG5_EF_L70SS_v5.pdf>");
> PDAcroForm pdAcroForm = pdDoc.getDocumentCatalog().getAcroForm();
> Iterator<PDField> iter = pdAcroForm.getFieldIterator();
> while (iter.hasNext()) {
>       PDField field = iter.next();
>       String fieldName = field.getPartialName();
>       System.out.println("field partial name: " + fieldName );
> }
> 
> PDF in question is here:     https://github.com/BarryNeu/shared <https://github.com/BarryNeu/shared>
> 
> Thanks in advance.
> Barry
> 

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