Friday, February 23, 2018

Okular gains some more JavaScript support

Andre Heinecke did some patches [1][2][3][4][5] over the last few weeks that finally got landed this week.

With it we support recalculation of some fields based on others. An example that calculates sum, average, product, minimum and maximum of three numbers can be found in this youtube video.



This code will be available for the Okular version that will ship with KDE Applications 18.04

2 comments:

Anonymous said...

Some more JavaScript support? That'd mean it already supported JS, however I could not find anything about it in the settings of Okular 1.2.3.
I hope there will be an option to deactivate JS completely as I actually don't see any reason to let a PDF execute any code, besides it increases the potential attack surface?

Kind Regards

Anonymous said...

Post-review of https://cgit.kde.org/okular.git/commit/?id=cead2bbef3c2878dfb42173f9885e8ab8a23cd86

- if ( cFunction === "AVG" )
+ if ( cFunction === "AVG" && cFields.length > 0 )
{
ret /= cFields.length;
}