GSoC/2019/StatusReports/JoãoNetto: Difference between revisions

From KDE Community Wiki
< GSoC‎ | 2019‎ | StatusReports
No edit summary
Line 4: Line 4:


== Work report ==
== Work report ==
First two weeks of the project were directed to the simply animations put all by the package beamer, this package works by setting some fields (in)visible, to do the animation. Everything was already implemented in Poppler/Okular to make it work, I just needed to edit the /script folder to support some functions that are on the PDF's Javascript.
===== Supporting Animated PDF =====
I also needed to make Okular support running scripts when the page were open/closed.
====== Implementation ======


The next two weeks I've implemented support for buttons and the animate package. This was harder since the get/set Icon wasn't implemented in Poppler, I had to edit Poppler to support this. This was a fun challenge since I never had tinkered with Poppler before, I spent two entire days just trying to figure out the codebase. After I did, implementing was pretty straightforward.
There is two LaTeX libraries that are able to produce animations, both use timers and JavaScript to do the frame switching needed for the animation, namely, the animate and TikZ beamer package.


The following diffs support the work above:
For supporting the animate package, I had to modify Poppler to support changing the Forms AP stream. This AP stream is what says to Poppler what and where to render.


Poppler - https://gitlab.freedesktop.org/poppler/poppler/merge_requests/297
Then, to support the animation of a PDF we need to support the JavaScript functions are executed when certain actions are performed. The first thing done to support this was editing the code when a page is opened to execute the Widget opening script. This script was already given by Poppler, I only made Okular execute it.
 
Other features that were implemented:
 
* '''Display -''' This feature defines if the form is visible and printable, there are four combinations defined in the API reference with these flags.
 
* '''OCGs -''' These are the Optional Content Group of the PDF, or the layers, basically you can alter then to be visible or invisible and it will render different things on the PDF, they are already supported by Okular, I just made the JavaScript tap into these already existing features and using them.
 
* '''Interval Functions -''' The base of the animation is to execute some actions in some pre defined interval, gladly we had QTimer to support this, I implemented them with a connection to execute the script given.
 
====== Results ======
Now we can reproduce any animations that are produce


Okular - https://gitlab.freedesktop.org/poppler/poppler


== Links to Blogs and other writing ==
== Links to Blogs and other writing ==

Revision as of 13:22, 20 July 2019

Improving Okular JavaScript Support

Adobe defines a set of JavaScript functions in its JavaScript for Adobe API reference. Our plan is to support the execution of these scripts by the documents opened in Okular.

Work report

Supporting Animated PDF
Implementation

There is two LaTeX libraries that are able to produce animations, both use timers and JavaScript to do the frame switching needed for the animation, namely, the animate and TikZ beamer package.

For supporting the animate package, I had to modify Poppler to support changing the Forms AP stream. This AP stream is what says to Poppler what and where to render.

Then, to support the animation of a PDF we need to support the JavaScript functions are executed when certain actions are performed. The first thing done to support this was editing the code when a page is opened to execute the Widget opening script. This script was already given by Poppler, I only made Okular execute it.

Other features that were implemented:

  • Display - This feature defines if the form is visible and printable, there are four combinations defined in the API reference with these flags.
  • OCGs - These are the Optional Content Group of the PDF, or the layers, basically you can alter then to be visible or invisible and it will render different things on the PDF, they are already supported by Okular, I just made the JavaScript tap into these already existing features and using them.
  • Interval Functions - The base of the animation is to execute some actions in some pre defined interval, gladly we had QTimer to support this, I implemented them with a connection to execute the script given.
Results

Now we can reproduce any animations that are produce


Links to Blogs and other writing