Linux - choose program to open PDF files from zotero

Problem statement: PDFs always open in evince

Hello, just to clarify, I have already read http://forums.zotero.org/discussion/4972/change-default-pdf-application-under-ubuntu-810firefox-30/ and http://forums.zotero.org/discussion/2241/open-pdfs-in-acrobat-reader-externally/

That means I have set both firefox (tested by browsing to a pdf using the internal file browser) and OS settings to open using acroread instead of evince. However, double-clicking on the pdf in zotero still uses evince. The about:config option for using native doesn't work. The debug log shows that zotero cannot find a handler within firefox for application/pdf.

I'm using the latest Gnome, in Arch Linux. Any suggestions?
  • I'm afraid this doesn't have anything to do with Zotero, which has no mechanism for controlling the external app. As CB notes at the end of the second thread, various OS settings affect the document handling on Linux, and it seems something is still set to use evince on your system.
  • I'm sorry, but what I'm seeing suggests that it IS a zotero issue. At the very least, zotero misidentifies the document type (since the firefox behaviour for application/pdf works when I browse to a pdf file) and thus passes the wrong type to firefox, forcing a fallthrough to OS handling. Where again the type doesn't seem to match with what the OS is expecting.

    I know this works for the majority of users, else there'd be much more complaints. However, I can just report things as I see them. Please advise if there's anything I can do to help track down the cause of this.
  • Zotero launches the file through the OS, nothing more. It doesn't "pass" the identified type anywhere, and it doesn't use Firefox's helper app mechanism (which is meant for downloads) as long as nsILocalFile.launch() is supported, which it should be on Linux.

    If you don't believe me, you can review the code yourself, but I wrote it, so you'd probably save yourself time if you did.
  • Thank you. I will continue to investigate the issue and post back here if there's something else to report.
  • ngoonee : I had the same problem as you. I finally found the solution! See post #23 here : http://forums.opensuse.org/applications/398397-gimp-default-opening-pdfs-firefox-3.html

    "to make pdf open using a specific application when you double click it in the FF download manager, edit /usr/share/applications/mimeinfo.cache , search for: application/pdf= . Put the name of *application*.desktop of the desired application right after = .

    So to use okular, it should look like this:
    application/pdf=kde4-okularApplication_pdf.desktop

    Notice the extra kde4- , this is necessary because okularApplication_pdf.desktop is in the subfolder kde4 in /usr/share/applications.

    Replace okularApplication_pdf.desktop with whatever name of the .desktop file of the app you want. If it's in the same folder as mimeinfo.cache, i.e. /usr/share/applications then use the name of the .desktop folder, if it's in a subfolder then prefix it with kde4- , or kde- , whatever. See if this works.

    mimeinfo.cache is a dynamic file and will be changed automatically when you install/uninstall a programme (this explains what happened when you uninstalled gimp). Of course you can keep a local copy of this file maintaining your own associations across reinstalls), you need to put this copy in ~/.local/share/applications , also a copy of /usr/share/applications/defaults.list "

    In your case, you'd want to put something like application/pdf=AdobeReader.desktop in both the mimeinfo.cache and defaults.list.

    I'll investigate some more, then I'll consider submitting a bug on Ubuntu's launchpad.
  • It works for me (ArchLinux, Gnome) only changing in file ~/.local/share/applications/defaults.list:

    application/pdf=evince.desktop

    to

    application/pdf=acroread.desktop

    BTW it seems that Nautilus 'open with' configuration has nothing to do with this!
  • Thank juanmah!
    Your solution works for me (Ubuntu 9.04, Gnome).
  • Worked for me too (Arch Linux, KDE), but I had to create a new ~/.local/share/applications/defaults.list from scratch, since it didn't exist, with the following content:


    [Default Applications]
    application/pdf=kde-okularApplication_pdf.desktop


    As this is probably an annoyance for a lot of Zotero users, I've added the solution to the wiki: http://www.zotero.org/support/troubleshooting_file_handlers
  • unhammer: Thanks for documenting this, but better to make it a KB page.
  • And you could possibly add it to http://www.zotero.org/support/kb/file_handling_issues (or pick a more specific name for what you're documenting).
  • OK, added to the kb page, I don't think I have rights to delete the other page though.
  • Hi,

    I'm running Ubuntu 10.10 and okularApplication_pdf.desktop is located in
    /usr/share/applications/kde4

    The entry in ~/.local/share/applications/defaults.list
    should therefore be:

    application/pdf=kde4-okularApplication_pdf.desktop

    This should be noted in the kb page...
  • I would add that but can't find the edit button... did something change in the wiki?
  • Ah, it's a separate login... thank you, Dan Stillman. Updated the kb page.
  • Thank-you all. I only just found this thread and it solved an annoying problem I had.
  • edited October 24, 2012
    Thank Apteryx, problem solved. I use ubuntu 10.04 and gnome 2.3.

    I want to set evince as default application to open pdf fulltext in zotero.

    Edit /usr/share/applications/mimeinfo.cache , ~/.local/share/applications/mimeinfo.cache , and /etc/gnome/defauts.list , search 'application/pdf= ....' , change it to 'application/pdf=evince.desktop'.
  • Zotero was using GIMP, and I too found my answer in this thread, but in post #31, not the one Apteryx referenced: http://forums.opensuse.org/applications/398397-gimp-default-opening-pdfs-firefox-3.html

    I am also using OpenSUSE.

    From that thread:
    "There is a file called: /usr/share/applications/defaults.list

    with a line:

    application/pdf=gimp.desktop

    just change to

    application/pdf=kde4-okular.desktop"
Sign In or Register to comment.