5

when opening a particular pdf file, evince decides to open it in "presentation mode".

I see in the man page that evince has -s option to open in presentation mode, but I did not invoke it. I am simply opening all pdfs as evince file.pdf

Somehow evince has decided on its own, to open this particular kind of pdf in presentation mode.

Other pdfs open just fine in normal window.

How can I disable this behavior?

marcelm
  • 2,378
  • 1
  • 13
  • 14
400 the Cat
  • 819
  • 4
  • 37
  • 85

2 Answers2

5

Following dodrg's answer you should edit the PDF metadata to change the PageMode field. Different values are accepted (source):

  • UseNone: When a document is opened in the viewer, it shows only pages (Bookmarks, Attachments, Page Thumbnails, and Layers panels are hidden).

  • UseOutlines: When a document is opened in the viewer, it shows pages and opens the Bookmarks panel to display outlines (bookmarks).

  • UseThumbs: When a document is opened in the viewer, it shows pages and opens the Page Thumbnails panel to display thumbnails.

  • FullScreen: When a document is opened in the viewer, it shows pages in full screen mode (no menu bar, window controls, or any other window is visible).

  • UseOC: When a document is opened, for example, in the Adobe Acrobat Reader, the Reader shows pages and opens the optional content group panel (the Layers panel).

  • UseAttachments: When a document is opened in the viewer, it shows pages and opens the Attachments panel to display attachments.

Various tools are available to edit PDF metadata like pdftk, exiftool, and qpdf. But from testing, it looks like only pdftk can actually add information to this metadata field.

To modify this metadata field, you may use the command

pdftk file.pdf update_info info.txt output output.pdf

where info.txt contains

PageMode: UseNone
3

Somehow evince has decided on its own, to open this particular kind of pdf in this idiotic mode.

The "decision" is due to a PDF feature:

/PageMode /FullScreen

You may wish to permanently disable it in the PDF itself by replacing it with

/PageMode /UseNone

... filling with 3 spaces at the end to keep filesize.

Note that evince stores the last presentation mode of a file so you might have to switch the previously viewed PDF to windowed mode first.

Very useful for frequently used PDFs. But for this question its only a workaround.

An example for how to patch:

sed -zE 's|(<<[^>]*/PageMode\s*)/FullScreen|\1/UseNone   |' Your.PDF > YourPatched.PDF

I would not do -i inplace as this search string is not fully failsafe for all thinkable cases.

dodrg
  • 173
  • 5
  • you are richt. The pdf does have `/PageMode /FullScreen`. But what do you mean by "filling with 3 spaces at the end to keep filesize" ? And can I tell evince to ignore this feature entirely, and always open in normal mode ? – 400 the Cat Aug 19 '23 at 10:06
  • if this can be disabled in the sourcode, that would work as well. I already had to compile my own evince package anyway, to disable other idiotic features and dependencies – 400 the Cat Aug 19 '23 at 10:09
  • @400theCat : You can find the PDF options like `/PagaMode` in the code of the PDF and patch it directly. No need to repackage the whole thing with the chance to change arbitrary other details. The three spaces probably aren't necessary as a PDF is not a classical binary, but it can contain some code so just for safety and it doesn't hurt... — I updated the answer by an example that would patch such a file. – dodrg Aug 19 '23 at 11:32
  • 2
    OK, but modifying each pdf file is not really practical. besides, I have evince as external viewer for my browsers - the pdf opens automatically. If this evil feature can be disabled in evince, that would be great. – 400 the Cat Aug 19 '23 at 11:40
  • True, its only a workaround for frequently used PDFs that you could save as a small script. // For more info about your "evince": Please check if you are really using "evince" or a substitute. Some distros link to "xreader". — Check by `ls -l $(which evince)`. – dodrg Aug 19 '23 at 12:03
  • I am definitely using evince. I compiled the package myself – 400 the Cat Aug 19 '23 at 12:06
  • Patching Evince could be quite a challenge, as it appears that the software lacks a straightforward override feature, in my understanding. A potential approach would involve delving into the source code of Evince and looking for `PageMode`. Then an attempt could be made to force the use of `UseNone` when sending data to the backend (Poppler). – Loïc Reynier Aug 19 '23 at 16:56
  • 1
    When patching the code, then it probably would be the task to disable the evaluation of the PDF attributes `fullscreen` and `presentation`. These are applied to the PDF's Gnome Metadata at PDF usage & attribute selection: `gio info file.pdf`. — Unfortunately setting `gio set metadata::evince::fullscreen 0` will be overridden by the internal properties of the PDF. // If you eliminate the PDF-property `/PageMode` instead to change the setting, then the `gio` metadata take effect. But they set only non-defaults and 400thecat just requests the defaut – dodrg Aug 19 '23 at 19:18