More and more PDF are using JavaScript, we should try to support it, sometime, somewhen.
This should probably be done using spidermonkey as the javascript interpreter. It is used by acrobat (http://www.adobe.com/devnet/logged_in/ehuang_tamarin.html)
*** Bug 32424 has been marked as a duplicate of this bug. ***
I really understand that you consider this an enhancement request, but I must say that as a user I see it as a bug, since the document doesn't work as expected. Anyway, just dropped to say I closed a bug report for Evince as NOTGNOME, and provided a link to this bug report. The former bug report is: https://bugzilla.gnome.org/show_bug.cgi?id=480324
This fix seems to be needed for Evince (GNOME) to handle automatic calculation with PDF fillable forms Any plan about it ? Mozilla's work on pdf.js (which could soon be integrated within Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=714712 ) could be helpful maybe ?
Created attachment 67189 [details] PDF test case with an animation in JavaScript I am adding a test case of JavaScript. This was reported in GNOME several years ago. https://bugzilla.gnome.org/show_bug.cgi?id=338721 When I tried to get the annotations using poppler-glib-demo (master b72c02d1a2e), I got the following output: Syntax Error: Can't get Fields array However, it got 6 widgets, which were not rendered.
Is this a duplicate of #14265?
(In reply to comment #6) > Is this a duplicate of #14265? Nope, I would say that #14265 depends on this bug.
It's more than calculations and such; I've encountered a document that has a "helpscreen" overlay that you are supposed to click on to make the box go away when you're done reading it. But since it is apparently using javascript to do it, you cannot get rid of the box, which covers a majority of the page, and tehrefore cannot fill out the fields. So no, not an enhancement, definitely a bug, since the document is completely unusable without the JS support. https://apps.health.ny.gov/doh2/applinks/accessny//forms/DOHAccessNyMainForm.pdf (the file is 3.5M, so too large to attach here).
(In reply to comment #8) > It's more than calculations and such; I've encountered a document that has a > "helpscreen" overlay that you are supposed to click on to make the box go > away when you're done reading it. But since it is apparently using > javascript to do it, you cannot get rid of the box, which covers a majority > of the page, and tehrefore cannot fill out the fields. So no, not an > enhancement, definitely a bug, since the document is completely unusable > without the JS support. > > https://apps.health.ny.gov/doh2/applinks/accessny//forms/DOHAccessNyMainForm. > pdf > Actually this files has something like this AA << /D <</S/Hide /T(Help1)>> >> so when clicking on the help widget, it should go away. So at least this is NOT related to our lack of javascript but two bugs in poppler. One is that we don't support Hide actions and the other is that the glib frontend does not support additional actions... these two should be filed as different bugs (and I will do so later) > (the file is 3.5M, so too large to attach here).
If this gets implemented one day: Considering that JavaScript can be used for malicious purposes, please consider providing a facility for allowing poppler-based applications to let interested end-users enable JS on a per-document basis.
So here's the reference manual: https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/js_api_reference.pdf There are interesting use cases for javascript in pdf files. The gnome desktop would benefit if supported! Maybe consider offering this as part of GSoC or something?
Please do NOT support more javascript features. Javascript is one of the most aweful things to put in pdf and an exellent target for malware. There would be a lot of new security issues coming along with it. In case one day there will be javascript inside poppler beyond formular filling, please provide a simple waz for users to disable it.
Actaully I think we should close this bug. We already export the Javascript from the poppler side and for example Okular supports it partially https://www.youtube.com/watch?v=S-zmHc3WUhs I don't think we could actually do that from within the core of poppler since it needs to know things as edit/validate/undo/redo. So from what i can see we already "support" Javascript, i.e. extract its contents.
See also: https://gitlab.gnome.org/GNOME/evince/issues/379
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/poppler/poppler/issues/162.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.