You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Rodney Kite <rk...@yahoo.com.INVALID> on 2015/10/29 07:23:34 UTC
Traversing and filling a PDF with 2.0
I have been using PDFBox 1.8 and have just tried 2.0. I have been using PDFBox to open a blank goverment PDF and fill out fields while walking the document like a DOM tree.
So I have been using PDField.getKids() a lot to traverse the document.
Can this still be done? Is there an example on how to do it? I have looked at the examples with the source but only see getting a field by name and setting it in the SetField.java example.
Re: Traversing and filling a PDF with 2.0
Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
Hi,
> Am 29.10.2015 um 07:34 schrieb Maruan Sahyoun <sa...@fileaffairs.de>:
>
> Hi,
>
>> Am 29.10.2015 um 07:23 schrieb Rodney Kite <rk...@yahoo.com.INVALID>:
>>
>> I have been using PDFBox 1.8 and have just tried 2.0. I have been using PDFBox to open a blank goverment PDF and fill out fields while walking the document like a DOM tree.
>>
>> So I have been using PDField.getKids() a lot to traverse the document.
>
> you can use
>
> for (PDField field : form.getFieldTree())
> {
>
>
> ... (do something)
> }
>
> BR
> Maruan
some additional information. PDFBox 2.0.0 now has
- PDTerminalField (a field which children are annotations). To get the annotations associated with the field you can use PDTerminalField.getWidgets().
- PDNonTerminalField (a field which children are fields). To get the children you can use PDNonTerminalField.getChildren().
The easiest is to use PDAcroForm.getFieldTree().
BR
Maruan
>
>>
>> Can this still be done? Is there an example on how to do it? I have looked at the examples with the source but only see getting a field by name and setting it in the SetField.java example.
>>
>
>
> ---------------------------------------------------------------------
> 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
Traversing and filling a PDF with 2.0
Posted by Rodney Kite <rk...@yahoo.com.INVALID>.
I have been using PDFBox 1.8 and have just tried 2.0. I have been using PDFBox to open a blank goverment PDF and fill out fields while walking the document like a DOM tree.
So I have been using PDField.getKids() a lot to traverse the document.
Can this still be done? Is there an example on how to do it? I have looked at the examples with the source but only see getting a field by name and setting it in the SetField.java example.