pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Grosso <gary.gro...@oberontech.com>
Subject RE: PDFormFieldAdditionalActions.setC() not working?
Date Tue, 30 May 2017 13:52:02 GMT
I'll have to learn more about how this works, but at least things are firing now. Thanks!

-----Original Message-----
From: Gary Grosso [mailto:gary.grosso@oberontech.com] 
Sent: Sunday, May 28, 2017 11:23 PM
To: users@pdfbox.apache.org
Subject: RE: PDFormFieldAdditionalActions.setC() not working?

Thanks so much, Maruan. It's too late now, but I'll surely give this a try tomorrow.

Gary


-----Original Message-----
From: Maruan Sahyoun [mailto:sahyoun@fileaffairs.de] 
Sent: Sunday, May 28, 2017 3:40 PM
To: users@pdfbox.apache.org
Subject: Re: PDFormFieldAdditionalActions.setC() not working?

Hi,

> Am 28.05.2017 um 20:04 schrieb Gary Grosso <gary.grosso@oberontech.com>:
> 
> I'm hoping someone has done calculations or other actions as the result of a textfield
changing and can share their experience with me.

you are missing to set the calculation order entry which is requiored if there are calculations.

Add something like this:

        PDField field = acroform.getField("SampleField2");
        COSArray calculationOrder = new COSArray();
        calculationOrder.add(field);
        acroform.getCOSObject().setItem("CO", calculationOrder);


BR
Maruan


> 
> Thanks,
> Gary
> 
> 
> -----Original Message-----
> From: Gary Grosso [mailto:gary.grosso@oberontech.com] 
> Sent: Friday, May 26, 2017 6:12 AM
> To: users@pdfbox.apache.org
> Subject: RE: PDFormFieldAdditionalActions.setC() not working?
> 
> In general, I can execute JavaScript from PDAnnotationAdditionalActions.setPO() to set
the current date as a field value, but I need to dynamically fill in some fields as the result
of a calculation using two or more other fields, and can't seem to do that. Perhaps I'm going
about it the wrong way? I can't seem to get anything at all to fire as the result of a text
field changing.
> 
> -----Original Message-----
> From: Gary Grosso [mailto:gary.grosso@oberontech.com] 
> Sent: Friday, May 26, 2017 12:19 AM
> To: users@pdfbox.apache.org
> Subject: PDFormFieldAdditionalActions.setC() not working?
> 
> In my project, I could not get setC to do anything, so I modified the CreateSimpleForm.java
code to create 2 fields (just in case that mattered), which resulted in http://aapro.net/PDF/SimpleForm.pdf.
> 
> Then I commented out a lot of distracting other event handling in FieldTriggers.java,
and duplicated everything to handle both fields, resulting in http://aapro.net/PDF/FieldTriggers.java
. This, when run gives http://aapro.net/PDF/FieldTriggers.pdf, which, in PDFDebugger looks
something like this:
> 
> AcroForm: (3) [3 0 R]
>   DA: /Helv o Tfo g
>   DR: (1) [70 R]
>     Fields: (2)
>       0: (12) [SOR] /T:Annot /S:Widget
>       1: (11) [60R] /T:Annot /S:Widget
>         AA: (2) [120 R]
>             C: (3) [19 O R] /T:Action
>                 JS: app.alert("On 'recalculate' action")
>                 S: Javascript
>                 Type: Action
>             D: (3) [13 o R] /T:Action
>                 JS: app.alert("On 'mouse down' action")
>                 S: Javascript
>                 Type: Action
> 
> Whatever I do, much as in my original project, I never see "On 'recalculate' action".
> 
> I get the expected (if somewhat annoying) behavior for setK, setF, and setV. Why not
setC?
> 
> Thanks,
> Gary
> 
> 
> 
> ---------------------------------------------------------------------
> 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
> 


---------------------------------------------------------------------
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


Mime
View raw message