2

At the moment, I can open a PDF in Evince (say) by typing

$ evince document1.pdf

Then the command

$ evince document2.pdf

starts a second instance of Evince and opens the new document in that instance. This is not what I want. Instead, I want to be able to send a signal to the (running) instance that will make it open the new document in that instance. As far as I can see, this isn't possible with either Evince or XPDF.

I need to use a shell command (rather than File->Open) for scripting purposes.

Is there a piece of PDF software that will allow me to do this?

Motivation: The program TeXStudio is a TeX compiler, bundled together with a PDF viewer. When the user presses a button, the TeX source is compiled to PDF, and the PDF file is displayed in a separate window. If this window is already open, the program displays the PDF content in the existing window. I want to duplicate this functionality using tiled Vim and Evince windows in a tiling window manager, with appropriate plugins linking the two.

3

Evince reloads the pdf file if changed, so you could use a dummy file to overwrite with the pdf that you want to show up.

            # preview dummy file, a blank pdf maybe.
            cp blank.pdf dummy.pdf
            evince dummy.pdf

            # show document1.pdf
            cp document1.pdf dummy.pdf

            # later..., show document2.pdf
            cp document2.pdf dummy.pdf

            # restore the default file
            cp blank.pdf dummy.pdf
1
  • It's a bit of a hack, but I like it! It certainly beats messing around getting DBUS to work and things like that. Nov 14 '15 at 20:08
1

You can use qpdfview to open documents in the same window but under different tab:

$ qpdfview --unique --instance texview file.pdf

That will spawn new window with that instance id if it doesn't exists or open file in new tab in existing instance.

The only downside here that it won't close previously opened file.

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.