Bug 14433 - Support JavaScript
Summary: Support JavaScript
Status: RESOLVED MOVED
Alias: None
Product: poppler
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
: 32424 (view as bug list)
Depends on:
Blocks: 14265 14397
  Show dependency treegraph
 
Reported: 2008-02-08 15:23 UTC by Albert Astals Cid
Modified: 2018-08-20 22:01 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:


Attachments
PDF test case with an animation in JavaScript (84.94 KB, application/pdf)
2012-09-14 22:46 UTC, Germán Poo-Caamaño
Details

Description Albert Astals Cid 2008-02-08 15:23:59 UTC
More and more PDF are using JavaScript, we should try to support it, sometime, somewhen.
Comment 1 Jeff Muizelaar 2008-02-21 20:11:18 UTC
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)
Comment 2 Albert Astals Cid 2010-12-15 14:59:40 UTC
*** Bug 32424 has been marked as a duplicate of this bug. ***
Comment 3 Leonardo Ferreira Fontenelle 2011-03-21 16:01:17 UTC
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
Comment 4 antistress 2012-02-11 09:40:09 UTC
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 ?
Comment 5 Germán Poo-Caamaño 2012-09-14 22:46:36 UTC
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.
Comment 6 Germán Poo-Caamaño 2012-09-14 22:47:02 UTC
Is this a duplicate of #14265?
Comment 7 Jose Aliste 2012-09-15 14:10:00 UTC
(In reply to comment #6)
> Is this a duplicate of #14265?

Nope, I would say that #14265 depends on this bug.
Comment 8 James E. LaBarre 2013-07-09 22:48:18 UTC
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).
Comment 9 Jose Aliste 2013-07-13 11:45:14 UTC
(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).
Comment 10 Octavio Alvarez 2016-05-05 00:56:26 UTC
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.
Comment 11 martink 2016-10-12 14:45:11 UTC
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?
Comment 12 sivmu 2016-10-12 21:33:46 UTC
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.
Comment 13 Albert Astals Cid 2017-03-03 21:20:08 UTC
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.
Comment 14 Bastien Nocera 2018-06-02 21:50:33 UTC
See also: https://gitlab.gnome.org/GNOME/evince/issues/379
Comment 15 GitLab Migration User 2018-08-20 22:01:33 UTC
-- 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.