-2

I am looking for a way to prepare pdf file which runs additional script when opened at linux. For example:

$ evince example.pdf
--- Hello, world! ---
(evince:11876): Gtk-CRITICAL **: gtk_widget_show: assertion 'GTK_IS_WIDGET (widget)' failed //usual stuff from log stream

Is there any way to do thing like this? Let's say that file is marked as executable etc etc.

Cheshire
  • 5
  • 1
  • 3
  • Possible duplicate of https://stackoverflow.com/questions/28289963/is-it-possible-to-execute-a-script-embedded-in-a-pdf-file – Robert Nov 22 '15 at 23:21

1 Answers1

0

No clean way of achieving this. But following are two approaches I could think of:

1) Take evince's source, modify to run whatever you want to run and compile.

2) Dirty hack:
i) Create an executable bash script "evince"
ii) Write all your necessary actions in the script
iii) At the end of the script, write /usr/bin/evince_orig $@
iv) Run command as root: mv /usr/bin/evince /usr/bin/evince_orig
v) Run command as root: mv /path/to/your/script /usr/bin/evince

alok
  • 502
  • 3
  • 15