3

I use the default document viewer Evince (version 3.14.2-0ubuntu2 for Ubuntu 15.04 Vivid) for opening my PDFs.

If I print a document by clicking File --> Print... and change any setting, e.g. select to print several pages on one sheet of paper in the Page Setup tab of the "Print" window, this setting stays persistent. Even after closing the program and opening it again later or after a reboot.

But this is not the behaviour I want. I sometimes print a document with 2 pages per sheet for example, but I want original size as default setting. I always forget to check this and then it prints everything in half the size accidentally.

It's fine if it keeps the settings for one open document until the window is closed, but it has to restore the standard behaviour when I exit Evince!

How can I achieve this? Are there any configuration options inside Evince that can trigger this, maybe only accessible via gconf/dconf? Or can it be done with an external script?

4

I just made my ~/.config/evince/print-settings config file read-only, what makes my current settings the "default" as evince can't overwrite them any more.

To do this, you may run the following command:

chmod -w ~/.config/evince/print-settings

If you remove the file print-settings, evince will recreate one with default values and file system permissions the next time it runs. So to undo any modification, it's enough to simply delete the file. No backup copy needed.

| improve this answer | |
  • I think making the print-settings file not writeable is enough. And deleting it will just make Evince create a new default file on the next start. Therefore I'm editing and reducing your answer to making the print-settings file read-only and accepting it, because that's the most simple solution. Thank you for the hint! :) – Byte Commander Oct 27 '15 at 8:35
  • Compare: unix.stackexchange.com/a/283259/5289 – student May 15 '16 at 10:50
1

Evince stores its printer settings in ~/.config/evince/print-settings. To restore a default setting each time we start evince we can just adapt the printer settings to our needs and let evince display a preview to save these settings.

We can now copy printer settings in a default file, e.g.

cp ~/.config/evince/print-settings ~/.config/evince/print-settings-default

to copy back these settings to the defaults for starting evince.

This can be done by calling a script like below:

#! /bin/bash

cp ${HOME}/.config/evince/print-settings-default ${HOME}/.config/evince/print-settings
evince "$*"

from a custom evince.desktop file we save in ~/.local/share/applications to override the default evince.desktop file in /usr/share/application (we can use this as a template to only change the Exec line pointing to our script above).

By this we could also create script with different printer settings for different tasks which we can then call by a custom .desktop file.

| improve this answer | |
  • In the shell script, I wrote evince $@ instead of plain evince, because without forwarding the arguments, evince will just show a blank window if you want to open a document with with it (e.g. from Firefox). Its also important that one does not leave out the %U parameter in the new evince.desktop file after the script executable. Maybe you want to edit this? – Byte Commander Sep 30 '15 at 15:36
  • I know, but I don't like doing major edits on others' posts, especially when it comes to changing code. Therefore I prefer to ask and to be asked when someone does that to me. Edits do not always show up in the notifications, so I can't be sure I'm able to check them all. – Byte Commander Sep 30 '15 at 19:08
  • I found a mistake. In the script, it has to be evince "$*" instead of `evince $@", because otherwise it will break if the filename contains spaces. I edited your answer to correct it. – Byte Commander Oct 5 '15 at 7:42
  • @terdon Look how stupid we were. Fiddling around with scripts, while the optimal solution is just a single command! >.< See the other answer, please. – Byte Commander Oct 27 '15 at 8:42
  • @ByteCommander scripting may be more versatile in that we can define different settings for different tasks, and we can maintain custom default settings. But true, if only for always resetting to a single default r/o is sufficient enough. – Takkat Oct 27 '15 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.