You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Andrew Bogdanov <ab...@accusoft.com> on 2016/09/16 15:04:49 UTC

Empty array when getting acroforms

Hi. I'm trying to retrieve an Acroform data of the PDF by using this code:

COSArray fields =
(COSArray)this.acroForm.getDictionaryObject(COSName.getPDFName("Fields"));

As a result I have got empty array, but this doc for sure have may filed
inside, if I open this doc through the console using

java -jar pdfbox-app-2.0.2.jsr PDFReader document_name.pdf
I am able to see all fields, please see attach

I noticed that such behavior is always happening when I'm trying to open
document that was merged from several documents in Acrobat DC

Re: Empty array when getting acroforms

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 19.09.2016 um 15:52 schrieb abogdanov@accusoft.com:
> But why then Acrobat DC renders those fields correctly in the same document?

These are a special type of annotations, so I'd expect Adobe to keep 
their values.

> By going back to merging, is there a way to tell that document was merged from other documents or not? Does PDFBox treat them differently?

No. One could guess by looking at many details, to see if there's a 
style change.

Tilman


>
> On 2016-09-16 18:54 (+0300), Tilman Hausherr <TH...@t-online.de> wrote:
>> Am 16.09.2016 um 17:04 schrieb Andrew Bogdanov:
>>> Hi. I'm trying to retrieve an Acroform data of the PDF by using this code:
>>>
>>> COSArray fields =
>>> (COSArray)this.acroForm.getDictionaryObject(COSName.getPDFName("Fields"));
>>>
>>> As a result I have got empty array, but this doc for sure have may
>>> filed inside, if I open this doc through the console using
>>>
>>> java -jar pdfbox-app-2.0.2.jsr PDFReader document_name.pdf
>>> I am able to see all fields, please see attach
>>>
>>> I noticed that such behavior is always happening when I'm trying to
>>> open document that was merged from several documents in Acrobat DC
>>>
>> What you saw are widget annotations. But your acroform array is indeed
>> empty, so you have no fields. So go back to the last step, i.e. the merging.
>>
>> Tilman
>>
>> ---------------------------------------------------------------------
>> 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: Empty array when getting acroforms

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

> Am 19.09.2016 um 15:52 schrieb abogdanov@accusoft.com:
> 
> But why then Acrobat DC renders those fields correctly in the same document?
> By going back to merging, is there a way to tell that document was merged from other documents or not? Does PDFBox treat them differently? 

would it be possible to upload pdf before and after merging to take a look?

Acrobat treates annotations which also have a Widget entry in their dictionary as form fields although there is no AcroForm entry. If that is really the case here that would be a potential improvement to PDFBox to behave the same. It's long ago that I've seen such a document still being used tough.

BR
Maruan


> 
> On 2016-09-16 18:54 (+0300), Tilman Hausherr <TH...@t-online.de> wrote: 
>> Am 16.09.2016 um 17:04 schrieb Andrew Bogdanov:
>>> 
>>> Hi. I'm trying to retrieve an Acroform data of the PDF by using this code:
>>> 
>>> COSArray fields = 
>>> (COSArray)this.acroForm.getDictionaryObject(COSName.getPDFName("Fields"));
>>> 
>>> As a result I have got empty array, but this doc for sure have may 
>>> filed inside, if I open this doc through the console using
>>> 
>>> java -jar pdfbox-app-2.0.2.jsr PDFReader document_name.pdf
>>> I am able to see all fields, please see attach
>>> 
>>> I noticed that such behavior is always happening when I'm trying to 
>>> open document that was merged from several documents in Acrobat DC
>>> 
>> 
>> What you saw are widget annotations. But your acroform array is indeed 
>> empty, so you have no fields. So go back to the last step, i.e. the merging.
>> 
>> Tilman
>> 
>> ---------------------------------------------------------------------
>> 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: Empty array when getting acroforms

Posted by "abogdanov@accusoft.com" <ab...@accusoft.com>.
But why then Acrobat DC renders those fields correctly in the same document?
By going back to merging, is there a way to tell that document was merged from other documents or not? Does PDFBox treat them differently? 

On 2016-09-16 18:54 (+0300), Tilman Hausherr <TH...@t-online.de> wrote: 
> Am 16.09.2016 um 17:04 schrieb Andrew Bogdanov:
> >
> > Hi. I'm trying to retrieve an Acroform data of the PDF by using this code:
> >
> > COSArray fields = 
> > (COSArray)this.acroForm.getDictionaryObject(COSName.getPDFName("Fields"));
> >
> > As a result I have got empty array, but this doc for sure have may 
> > filed inside, if I open this doc through the console using
> >
> > java -jar pdfbox-app-2.0.2.jsr PDFReader document_name.pdf
> > I am able to see all fields, please see attach
> >
> > I noticed that such behavior is always happening when I'm trying to 
> > open document that was merged from several documents in Acrobat DC
> >
> 
> What you saw are widget annotations. But your acroform array is indeed 
> empty, so you have no fields. So go back to the last step, i.e. the merging.
> 
> Tilman
> 
> ---------------------------------------------------------------------
> 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: Empty array when getting acroforms

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 16.09.2016 um 17:04 schrieb Andrew Bogdanov:
>
> Hi. I'm trying to retrieve an Acroform data of the PDF by using this code:
>
> COSArray fields = 
> (COSArray)this.acroForm.getDictionaryObject(COSName.getPDFName("Fields"));
>
> As a result I have got empty array, but this doc for sure have may 
> filed inside, if I open this doc through the console using
>
> java -jar pdfbox-app-2.0.2.jsr PDFReader document_name.pdf
> I am able to see all fields, please see attach
>
> I noticed that such behavior is always happening when I'm trying to 
> open document that was merged from several documents in Acrobat DC
>

What you saw are widget annotations. But your acroform array is indeed 
empty, so you have no fields. So go back to the last step, i.e. the merging.

Tilman

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