Skip to content

Go to requested page for links to external PDF documents

ningit requested to merge ningit/evince:main into main

This change solves an issue regarding links to external PDF documents. The expected behavior is that Evince opens the external document on the page indicated in the link when clicking on it, but the document is instead opened on its first of last visited page.

Links to external documents in PDF (GoToR actions) specify either a page number or a named destination in the target file. However, Evince ignores page numbers when spawning a new evince instance for the external file in ev_spawn. The command is added the --page-index option with the appropriate page number only when the link destination type is EV_LINK_DEST_TYPE_PAGE, but this is an unlikely fallback value for destination types not supported by Poppler (as can be seen in the ev_link_dest_from_dest function in ev-poppler.c:1169). The actual types including a page number are EV_LINK_DEST_TYPE_XYZ, EV_LINK_DEST_TYPE_FIT, EV_LINK_DEST_TYPE_FITH, EV_LINK_DEST_TYPE_FITV, and EV_LINK_DEST_TYPE_FITR.

This merge requests simply adds these enumerate values to the case of EV_LINK_DEST_TYPE_PAGE in the switch dealing with destinations of ev_spawn. External PDF are now opened on the page indicated in the link.

These destination types also specify how the page should be displayed within the window, but this is ignored because there are no command-line arguments to pass on this information.

Merge request reports