4

Is there a PDF viewer that I can control from a Python program, via dbus, a pipe, or something similar?

I have a program for presentations that displays my own notes while displaying a PDF on a projector. Right now, my program spawns mupdf and tells it to navigate forward or backward with things like

subprocess.call('xdotool search mupdf key Next'.split())

which does work, but seems brittle.

(Evince has some support for SyncTeX over dbus, but looking at the source, it seems like Evince doesn't expose any other functions via dbus.)

I don't want to reinvent the wheel and make my own PDF viewer. Is there some viewer that I can control from Python, using any kind of reasonable inter-process communication?

1
  • According to its manual, qpdfview ships with an 'introspectable DBUS-interface'. You might want to give that a try. Also, if you do go with qpdfview please do post an answer on how you utilized the DBUS interface. I haven't been able to find any documentation on that and it would be great to have a tutorial to refer to when needed. Mar 5, 2015 at 13:12

1 Answer 1

0

Since you mention presentation slides, what about using OpenOffice or LibreOffice Impress? You can add Python scripting bindings to LibreOffice (in Ubuntu install the libreoffice-script-provider-python package) HOWEVER I don't know what LibreOffice can provide for calling it from "outside" processes. Presumably this might be even more "brittle," depending on how it's implemented. The other scripting languages in LibreOffice (or OpenOffice) might be better supported, too -- I mentioned python just because it's there.

If you want to display existing .pdf files, you can import them into Impress (maybe via Draw).

2
  • I make my slides in LaTeX; using Impress to make my slides isn't a reasonable option. Importing a PDF and using Impress on that seems like an extra step...but if that step replaces my possibly-brittle xdotool call, I guess that might be worth it.
    – Dan Drake
    Mar 4, 2015 at 16:46
  • There are some scripts to go back and forth between LaTeX and open document formats, and there might even be an import filter available? Probably not worth pursuing, but one advantage OpenOffice & LibreOffice have is their scripting interfaces, and some ability to pass parameters via the command line. Mar 5, 2015 at 19:17

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.