[Okular-devel] Redrawing the screen due to optional content group changes

Albert Astals Cid aacid at kde.org
Thu Jul 16 22:16:41 UTC 2015


El Dimecres, 15 de juliol de 2015, a les 18:10:03, Jeremy Maitin-Shepard va 
escriure:
> I've started to add sufficient Javascript support in order for animate.sty
> latex animations to work.  In my opinion this is quite valuable
> functionality since I am not aware of any way to make PDF animations that
> can be displayed in a free software PDF viewer.

Nice :)

> 
> animate.sty supports 3 modes for generating the animation:
> 
> 1. icon mode: This requires being able to look up an icon (corresponding to
> the frames of the animation) by name via getIcon, and to change the icon
> associated with a form widget using buttonSetIcon.  I'm not exactly sure
> what an icon is, and poppler doesn't seem to support any of these
> operations, so this method doesn't seem very promising.
> 
> 2. widget-based: This requires being able to change the visibility of a
> form widget.  Again, poppler doesn't seem to support this, so this method
> isn't very promising.
> 
> 3. optional content group (ocg)-based: This requires being able to set the
> visibility of optional content groups.  Poppler does in fact have some (not
> well-documented) support for this.
> 
> I implemented the necessary Javascript interface for optional content
> groups, via the QAbstractItemModel interface provided in
> poppler-optcontent.  I also implemented the necessary Javascript timer
> functionality.  The result is that animations almost work.  The problem is
> that Okular doesn't seem to get notified about the visibility changes, so a
> new frame is only shown if the zoom level is changed to force a redraw.
> 
> Any advice about how to deal with this redraw problem?

Trigger the redraw yourself? See Saheeb's branch for optinal content 
(origin/gsoc2015_layer_feature), I'd say it probably makes sense for you to 
base your work on his branch.

Cheers,
  Albert

> 
> The patch implementing these changes (WIP) is attached.  See also example
> LaTeX file.  Use pdflatex to generate a pdf.  To debug the generated
> JavaScript, I found it is helpful to copy animate.sty to the local
> directory, and then edit it to add console.println statements into the
> generated code.
> 
> Note: The Javascript code, which should be triggered by page load, doesn't
> seem to get run until you switch to presentation mode.  To actually see the
> animation, you have to switch back to regular view mode, and then quickly
> toggle the zoom level.



More information about the Okular-devel mailing list