You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Ulf Dittmer <ul...@googlemail.com.INVALID> on 2025/06/04 17:20:01 UTC

Another PDF with non-behaving form fields

This one is https://ulfdittmer.com/pdfbox/Guide_HE.pdf
<https://ulfdittmer.com/pdfbox/Guide_BW.pdf>

I can use PDFBox to fill in the fields on page 1, but not some of those on
page 2 - they're not changed. Specifically, "Wohnanschrift im Ausland:
Staat" and "Adresse" as well as "E-Mail-Adresse" and "Telefonnummer"

The PDFBox Debugger shows those form fields, but the PrintFields example
code (
https://github.com/apache/pdfbox/blob/trunk/examples/src/main/java/org/apache/pdfbox/examples/interactive/form/PrintFields.java)
does not. Those 4 that I mentioned are not in its output, and using the
field names from PDFDebugger does not work.

Am I missing something, or is there more going on?

Re: Another PDF with non-behaving form fields

Posted by "sahyoun@fileaffairs.de" <sa...@fileaffairs.de>.
Hello Ulf,

pdfbox does apply some fix ups automatically when doing .getAcroForm().
One is to check for widgets which doen't have a field entry as is the
case in your form and create them.

You can look up the code in AcroFormDefaultFixup.

The way it's currently done is that this only kicks in if there are no
fields at all, which is not the case in your form.

But you can create your own fix up and call
.getAcroForm(PDDocumentFixup acroFormFixup)

In this fix up you can reuse AcroFormOrphanWidgetsProcessor which
creates field entries from widgets.

I havn't tested that with your form but when we created this mechanism
we had in min dthat this should enable users of the lib to create their
own handling reusing some of the code we supply or creating from
scratch.

BR
Maruan 

Am Donnerstag, dem 05.06.2025 um 10:45 +0200 schrieb Ulf Dittmer:
> 3.0.5
> 
> On Thu, Jun 5, 2025 at 10:40 AM sahyoun@fileaffairs.de <
> sahyoun@fileaffairs.de> wrote:
> 
> > Hello Ulf,
> > 
> > which pdfbox version are you using?
> > 
> > BR
> > Maruan
> > 
> > 
> > 

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


Re: Another PDF with non-behaving form fields

Posted by Ulf Dittmer <ul...@googlemail.com.INVALID>.
3.0.5

On Thu, Jun 5, 2025 at 10:40 AM sahyoun@fileaffairs.de <
sahyoun@fileaffairs.de> wrote:

> Hello Ulf,
>
> which pdfbox version are you using?
>
> BR
> Maruan
>
>
>

Re: Another PDF with non-behaving form fields

Posted by "sahyoun@fileaffairs.de" <sa...@fileaffairs.de>.
Hello Ulf,

which pdfbox version are you using?

BR
Maruan


Am Donnerstag, dem 05.06.2025 um 10:08 +0200 schrieb Ulf Dittmer:
> Weird, macOS Preview considers them as fields, making it possible to
> enter data.
> 
> But happily, entering blanks, and then saving it (using macOS
> Preview), makes them proper fields, and then PrintFields can see
> those fields. I'll try that first next time :-)
> 
> Thanks for looking at it!
> 
> Ulf
> 
> On Thu, Jun 5, 2025 at 5:54 AM Tilman Hausherr
> <TH...@t-online.de> wrote:
> >  
> >  
> > These fields are not in the acroform field list, that is why. This
> > is the acroform field list:
> >  
> > 
> >  
> >   
> > 
> >  
> >  
> > The page 2 "fields" only exist as annotations:
> >  
> > 
> >  
> >   
> > 
> >  
> >  
> > Something must have gone wrong when generating this PDF.
> >  
> > 
> >  
> >  
> > Tilman
> >  
> > 
> >  
> >  
> > On 6/4/2025 7:20 PM, Ulf Dittmer wrote:
> >  
> >  
> > >  
> > > This one is https://ulfdittmer.com/pdfbox/Guide_HE.pdf
> > > <https://ulfdittmer.com/pdfbox/Guide_BW.pdf>
> > > 
> > > I can use PDFBox to fill in the fields on page 1, but not some of
> > > those on
> > > page 2 - they're not changed. Specifically, "Wohnanschrift im
> > > Ausland:
> > > Staat" and "Adresse" as well as "E-Mail-Adresse" and
> > > "Telefonnummer"
> > > 
> > > The PDFBox Debugger shows those form fields, but the PrintFields
> > > example
> > > code (
> > > https://github.com/apache/pdfbox/blob/trunk/examples/src/main/java/org/apache/pdfbox/examples/interactive/form/PrintFields.java
> > > )
> > > does not. Those 4 that I mentioned are not in its output, and
> > > using the
> > > field names from PDFDebugger does not work.
> > > 
> > > Am I missing something, or is there more going on?
> > > 
> > >  
> >  
> > 
> >  
> >  

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


Re: Another PDF with non-behaving form fields

Posted by Ulf Dittmer <ul...@googlemail.com.INVALID>.
Weird, macOS Preview considers them as fields, making it possible to enter
data.

But happily, entering blanks, and then saving it (using macOS Preview),
makes them proper fields, and then PrintFields can see those fields. I'll
try that first next time :-)

Thanks for looking at it!

Ulf

On Thu, Jun 5, 2025 at 5:54 AM Tilman Hausherr <TH...@t-online.de>
wrote:

> These fields are not in the acroform field list, that is why. This is the
> acroform field list:
>
>
> The page 2 "fields" only exist as annotations:
>
>
> Something must have gone wrong when generating this PDF.
>
> Tilman
>
> On 6/4/2025 7:20 PM, Ulf Dittmer wrote:
>
> This one is https://ulfdittmer.com/pdfbox/Guide_HE.pdf<https://ulfdittmer.com/pdfbox/Guide_BW.pdf> <https://ulfdittmer.com/pdfbox/Guide_BW.pdf>
>
> I can use PDFBox to fill in the fields on page 1, but not some of those on
> page 2 - they're not changed. Specifically, "Wohnanschrift im Ausland:
> Staat" and "Adresse" as well as "E-Mail-Adresse" and "Telefonnummer"
>
> The PDFBox Debugger shows those form fields, but the PrintFields example
> code (https://github.com/apache/pdfbox/blob/trunk/examples/src/main/java/org/apache/pdfbox/examples/interactive/form/PrintFields.java)
> does not. Those 4 that I mentioned are not in its output, and using the
> field names from PDFDebugger does not work.
>
> Am I missing something, or is there more going on?
>
>
>
>

Re: Another PDF with non-behaving form fields

Posted by Tilman Hausherr <TH...@t-online.de>.
These fields are not in the acroform field list, that is why. This is 
the acroform field list:


The page 2 "fields" only exist as annotations:


Something must have gone wrong when generating this PDF.

Tilman

On 6/4/2025 7:20 PM, Ulf Dittmer wrote:
> This one ishttps://ulfdittmer.com/pdfbox/Guide_HE.pdf
> <https://ulfdittmer.com/pdfbox/Guide_BW.pdf>
>
> I can use PDFBox to fill in the fields on page 1, but not some of those on
> page 2 - they're not changed. Specifically, "Wohnanschrift im Ausland:
> Staat" and "Adresse" as well as "E-Mail-Adresse" and "Telefonnummer"
>
> The PDFBox Debugger shows those form fields, but the PrintFields example
> code (
> https://github.com/apache/pdfbox/blob/trunk/examples/src/main/java/org/apache/pdfbox/examples/interactive/form/PrintFields.java)
> does not. Those 4 that I mentioned are not in its output, and using the
> field names from PDFDebugger does not work.
>
> Am I missing something, or is there more going on?
>