Hello, On Thu, 2011-10-13 at 07:00 -0300, [email protected] wrote: > Hi, > > On Thu, Oct 13, 2011 at 4:04 AM, Nedim Srndic <[email protected]> wrote: > > Hi, > > > > On Wed, 2011-10-12 at 17:08 -0300, [email protected] wrote: > >> Hi, > >> > >> On Wed, Oct 12, 2011 at 10:26 AM, Albert Astals Cid <[email protected]> wrote: > >> > A Dimecres, 12 d'octubre de 2011, Nedim Srndic vàreu escriure: > >> >> Dear list, > >> >> > >> >> Poppler's Catalog class has a getJS() method that returns JavaScript > >> >> scripts from the PDF document. > >> >> http://www.google.com/codesearch#F0okAQSJLc0/poppler/Catalog.h&q=javascript% > >> >> 20package:poppler&type=cs&l=187 > >> >> > >> >> It currently only scans the Name tree for JavaScript scripts, but they > >> >> can also be found in many other places in a PDF document. It is not so > >> >> straightforward to find this in the PDF reference. I had to, though, so > >> >> I wrote a very compact C++ library called libpdfjs that looks for > >> >> JavaScript strings in those locations where the PDF reference says they > >> >> might be found (except for attachments, need to implement that). The > >> >> library home page is here: > >> >> https://sourceforge.net/p/libpdfjs/home/Home/ > >> >> > >> >> Do you (Poppler developers) plan to support something like this in the > >> >> future? If you do, then maybe the libpdfjs functionality can be moved to > >> >> Poppler and libpdfjs obsoleted. > >> > > >> > >> > As far as I know there is noone working on it. We will gladfully accept > >> > your > >> > patches though. > >> I have some wip patches in my branch that add this functionality to > >> poppler. I'll take a look into your lib but as Albert says, if you > >> feel like providing a patch for poppler, that would be great. > >> > > > > It would be very useful if one of the developers could review the code, > > well, your code is not going to be reviewed unless you provide patches > for poppler ;) > I took a quick look about it and some of the internal methods you are > using are things we want.
Yeah, my concern is that I may be doing something wrong, i.e., not according to the Poppler coding standards. Want to avoid that. > > > so that we know if it's acceptable/desirable. Also, the JavaScript is > > spread across the document in many places, and currently the library > > does not differentiate between them. Is that OK? > > I think you are missing a point by doing it like this. In popppler > there are already many objects that have actions and what you need to > do it is to support a javascript action on them, and add the api so > you can query that. In general you need to know where the action came > from so you can execute the code in the runtime whenever is > appropriate. OK, what I made was code that finds all the JavaScript in a PDF document. What you are suggesting is, if I understand, to create a new action type for JavaScript and patch all PDF object classes in Poppler (such as Annotations and Name trees) that support JS actions to have something like a getJSAction() method. That might be worth doing if somebody is going to make use of this (except for myself, obviously). AFAIK, none of the PDF readers using Poppler have a JS engine. Maybe they would consider having one if they had easy access to the underlying JS scripts. That's up to them to decide I guess. > > I will try to upload the finished part of my patches soon so we can > get a review from core devs. Does that mean that you already created some patches based on libpdfjs? Best regards, Nedim Srndic > > > > > I would be glad to provide a patch. Would it be OK to put the code in > > the getJS() method? > > > >> José > >> > >> > > >> > Albert > >> > > >> > > >> >> > >> >> Greetings, > >> >> Nedim Srndic > >> >> > >> >> _______________________________________________ > >> >> poppler mailing list > >> >> [email protected] > >> >> http://lists.freedesktop.org/mailman/listinfo/poppler > >> > _______________________________________________ > >> > poppler mailing list > >> > [email protected] > >> > http://lists.freedesktop.org/mailman/listinfo/poppler > >> > > >> _______________________________________________ > >> poppler mailing list > >> [email protected] > >> http://lists.freedesktop.org/mailman/listinfo/poppler > > > > > > _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
