Add support for chained / next actions
ClosedPublic

Authored by aheinecke on Mar 23 2018, 12:37 PM.

Details

Summary

This adds support for multiple actions following each
other through the "Next" value of Action dictionaries.

Test Plan

Activates the corresponding part of the visibilitytest.

Diff Detail

Repository
R223 Okular
Lint
No Linters Available
Unit
No Unit Test Coverage
aheinecke requested review of this revision.Mar 23 2018, 12:37 PM
aheinecke created this revision.
aheinecke added inline comments.
generators/poppler/generator_pdf.cpp
493

@aacid When you commited the corresponding poppler patch you did not add this API.

The problem here is:

  • In the LinkPrivate dtor we delete the nextLinks list.
  • createLinkFromPopplerLink deletes the parsed the link.

My solution for this was to add API to change the nextLinks so that they can be "taken" from a Link.

Maybe in poppler we could add "Poppler::Link::takeNextLinks()" to have a more explicit API for that?

Alternatively changing "createLinkFromPopplerLink" to optionally not delete the link it parses? I think that is a bit more error prone as we have to make sure we catch everything. For example the movie and rendition actions have their own deletion.

aacid added inline comments.Apr 17 2018, 7:37 AM
generators/poppler/generator_pdf.cpp
493

We have some takeXX functions but i personally don't like them much because they "break" the object, it may be very well possible that at some point we need to do getNextLinks somewhere else and we wouldn't see "we're doing it wrong" easily, since it would just be returning an empty list.

I think adding a parameter to createLinkFromPoppler is the way to go, and yes it already is not great that createLinkFromPoppler behaves "randomly" in whether it should delete or not the links it gets.

aheinecke updated this revision to Diff 32471.Apr 18 2018, 1:23 PM

Changed to handle deletion of the link actions more explicit
and to compile against the commited poppler patch.

Are you sure you need s_doNotDeleteLinks ? I mean the links where deleting in resolveMediaLinks doesn't look like they can be nextActions, since it's the Opening/Closing/Activation actions we're resolving on

void PDFGenerator::resolveMediaLinkReferences( Okular::Page *page )

no?

Right, I overlooked this a bit and assumed that the references were resolved on demand.
But I think we could also say that we should resolve the MediaLinkReferences of the next actions, too.

Looking at this more I see the problem that if we have a movie action
as a next action it would be executed but the media links won't be resolved.
I'm not really sure if this would be bad (crash) or if the second action just won't work.

I've tried to create a test document with Adobe Acrobat Pro DC but ended up
frustrated and unable to create Movie or Rendition Actions (except for the Page Open Action).
I was unable to add Media that was compatible with the "Play Media (Acrobat 5 compatible)" and
"Play Media (Acrobat 6 compatible)" actions, which I expect to be
Movie / Rendition actions.

The only thing I could do with added Movies was to create "RichMediaExecute" actions,
which are (as far as i can tell) not supported by poppler. So it looks to me that Movie / Rendition actions
are somewhat deprecated by Adobe Acrobat.

As we don't have a testcase I think its probably better to just leave it unsupported. I'll update the patch accordingly.

aheinecke updated this revision to Diff 33048.Apr 25 2018, 8:29 AM

Removed unused deletion prevention for media links.
Noted instead that nextActions containing MovieActions or
RenditionActions are unsupported.

sander added a subscriber: sander.Apr 25 2018, 10:32 AM

I've tried to create a test document with Adobe Acrobat Pro DC but ended up
frustrated and unable to create Movie or Rendition Actions (except for the Page Open Action).

Would using LaTeX and the 'multimedia' package help here? I know it create Movie _annotations_ .
Is that the same as movie _actions_?

I've tried to create a test document with Adobe Acrobat Pro DC but ended up
frustrated and unable to create Movie or Rendition Actions (except for the Page Open Action).

Would using LaTeX and the 'multimedia' package help here?

Googling around it at least brought me to http://pages.uoregon.edu/noeckel/PDFmovie.html This page at least describes some formats and with an example document with which I was able to create rendition actions. And even trigger the debug output I added here.
But I was unable to get the rendition action to work (even without having it as a chained action) in Okular. The page open play works fine.

Here is my try:

I know it create Movie _annotations_ . Is that the same as movie _actions_?

No. From the PDF reference on movie actions:

The contents of a movie action dictionary are identical to those of a movie activa-
tion dictionary (see Table 9.31 on page 785), with the additional entries shown in
Table 8.59. The contents of the activation dictionary associated with the movie
annotation provide the default values. Any information specified in the movie ac-
tion dictionary overrides these values.

So there is a difference.

To be honest, I think that Movie actions and Renditon actions are deprecated, don't fully work and are exotic.
The most common usecase appears to be to have the Annotations on page open etc, which works.
So I think we can, with good conscience, skip the support for them in this new feature here.

People in my field still use Movie annotations, by means of LaTeX/multimedia. Any improvement to their support is always welcome. :-)

aacid accepted this revision.Apr 30 2018, 12:02 PM

I'm with Andre, if someone has a document with next actions that are movie actions we'll figure it out, otherwise for the moment it's not really important to try to prepare the code for it.

This revision is now accepted and ready to land.Apr 30 2018, 12:02 PM
This revision was automatically updated to reflect the committed changes.