Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Open pdfs in Zotero with a different program than your other pdfs

I want to open pdf files with program A unless it is stored in Zotero, in which case I want to open it program B.

  1. Change the OS settings, so the default program for opening pdf files is the shell script shown below.
  2. Set Zotero preferences to store files in "zotero-data".

Below, I use playonlinux to launch Foxit Reader for my Zotero pdf files because Foxit has nice highlighting and annotation features that I like to use on scientific articles. I use evince for all other pdf files (figures, books, documents, etc.)

#!/bin/bash

# Check if the pdf is in the Zotero folder.
if [[ "$1" == */zotero-data/storage/* ]]
then
    # Replace all / with \ (needed for the windows program Foxit Reader)
    f="z:${1//\//\\}"
    /usr/share/playonlinux/playonlinux --run "Foxit Reader" "$f"
else
    evince "$1"
fi
@joelostblom

This comment has been minimized.

Copy link

@joelostblom joelostblom commented Jun 25, 2016

Nifty, thanks!

@diegodlh

This comment has been minimized.

Copy link

@diegodlh diegodlh commented Jan 12, 2018

Great idea

@bestucan

This comment has been minimized.

Copy link

@bestucan bestucan commented Jun 13, 2018

It works. thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment