You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Maruan Sahyoun (JIRA)" <ji...@apache.org> on 2016/06/22 20:29:16 UTC

[jira] [Commented] (PDFBOX-3393) Javascript actions on form fields cause data to become hidden

    [ https://issues.apache.org/jira/browse/PDFBOX-3393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15345106#comment-15345106 ] 

Maruan Sahyoun commented on PDFBOX-3393:
----------------------------------------

That's currently intended i.e. the appearance stream is only updated if there are no actions. What we could do is remove the test and set the value but that will be done without respecting the JavaScript code i.e. any calculation, formatting etc. will not be executed but the supplied value will be taken as a base. As this is changing the current behavior I don't see that in a patch release. It needs at least  a minor release i.e. 2.1.0. I think. 

> Javascript actions on form fields cause data to become hidden
> -------------------------------------------------------------
>
>                 Key: PDFBOX-3393
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3393
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: AcroForm
>    Affects Versions: 2.0.2
>            Reporter: Scott Coldwell
>             Fix For: 2.1.0
>
>         Attachments: SF3102.pdf
>
>
> We have run across numerous PDFs that contain javascript actions on some of the form fields.  When trying to set a value for the field, the data is there in the field, but only visible if you place the cursor in the field.  And since we flatten forms before saving them, it looks as if the data was never populated.  Some of the actions we've seen are like the following:
> AFDate_KeystrokeEx("mm/dd/yyyy")
> AFNumber_Keystroke(0, 0, 0, 0, "", true);
> As a workaround we are remove any actions associated with a field before setting a value by doing the following:
> {code}
> final PDField field = form.getField(fieldName);
> if (field instanceof PDTerminalField)
> {
>     // Need to clear any actions (typically javascript) from the fields
>     ((PDTerminalField)field).setActions(null);
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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