ZotFile - Advanced PDF management for Zotero

  • I have added a github issue but I don't have plans to do something about it right now. I thought about using file size for a moment but might also be problematic.
  • yourwelcome, your problem is solved in the current development version. I also posted on your original thread
  • Hi Joscha,

    I'm new at using zotfile. I want to use the wildcards option but I cannot make it work with the firefox addon. In about:config I cannot find zotfile.wildcards.default, and even when I define zotfile.wildcards.user following your example, I cannot make it work.

    Is there a way of debugging the wildcards?
  • edited January 15, 2014
    note that's a Zotfile 3.1 version feature - it's not up on mozilla add-ons yet, you'll have to build it yourself as per
  • Hi, is there any way to change the length of time the Zotfile pop-up box remains on-screen? I would like it there longer.
  • Hello,
    I'm just trying to set up my existing database (Bibtex) and pdf collection for use in Zotero. Unfortunately I had to learn that Zotero cannot use an existing pdf collection as it is and will copy it into its own (rahter hidden) filesystem. But then I was lucky to find out that zotfile is able re-export these pdfs, even without renaming (found the option ;-). Now my only problem is that if a pdf file is already existing in the destination directory, zotfile will double it, e.g. "Panio.2012.pdf" is existing, I get a "Panio2.pdf" file in the same subdirectory.
    Is there any option that will make zotfile NOT copy the file if it is already pre-existing ? I know this is dangerous, but might be helpful in the case that a pre-existing pdf collection has been imported into Zotero, and should be re-exported to work with linked files.
    I hope this is clear (it's friday late-afternoon ;-)
  • I'm trying to use the Make function to compile a mac xpi from the github source. It keeps returning an error that all of the folders (chrome, content, etc.) are not found. Am I unzipping and locating the files incorrectly? Thanks!
  • works for me. What exactly are you doing?
  • edited January 24, 2014
    With devtools installed:

    computer:zotfile-master User$ make


    sed: illegal option -- r
    usage: sed script [-Ealn] [-i extension] [file ...]
    sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
    make: *** No rule to make target `zotero--fx.xpi', needed by `all'. Stop.

    This creates a Makefile.in file, but otherwise generates no output.
  • when you open Makefile with a text editor - what does the line starting with "RELEASE" say?
  • It says:
    RELEASE:=$(shell grep em:version install.rdf | head -n 1 | sed -r 's/^.*>(.*)<.*$$/\1/')
  • I'm not sure if that's the only problem, but for some reason your computer seems to choke on the sed command.
    I'd just follow the manual instructions for zipping and renaming this instead of the make command, but if you do want to further troubleshoot, first thing I'd try is to delete the entire line and then further down use
    echo "all: zotero-3.1-fx.xpi" > Makefile.in

    @joscha - in case you're reading along. The makefile incorrectly calls all of this "zotero" rather than "zotfile" - not a big deal, the installed add-on ins correct, but still probably worth fixing.
  • edited January 25, 2014
    When I manually zip and rename the file on a mac, it returns an error when I try to install it, so I'll try out the altered code. Forgive me, linux is not my native environment and I have a research assistant who uses a mac.
  • so what exactly are you downloading? Maybe that's the problem?
  • The zip file from the github page. Worked on another system, so something must be wrong with my setup. Thanks for the help.
  • if you have this working on another computer, why not pack it there and just e-mail the .xpi?
  • Yes, that was the eventual solution.
  • Thanks very much for this fantastic tool. I have a feature request to add to the pile: it would be great if the script which renames PDF files based on their meta data would account for whether or not the PDF is the arXiv version (as opposed to the final published version). Since the arXiv information is explicitly encoded in the PDF, this should be relatively easy. An example would be

    Johnson - 1998 - Photons and Gravitons - arXiv 1234.5678v3

    This is necessary because it's usually very inconvenient to maintain different bibliography entries for the arXiv vs. published version, and it would be nice to tell which is which when I'm deciding whether to update the PDF.

    Also, the "Donate" PayPal button isn't working on the ZotFile website for Chrome, Firefox, or IE!
  • Thanks so much for the tool. I've just installed it and it looks very promising.

    I've got an issue. Commenting on a simple document in adobe reader I found zotfile can extract highlights and sticky notes, but not text comments. All the notes I mentioned are viewable in firefoxe pdf.js. Is there anyway to get zotfile to extract text comments as well?

    zotero standalone v4.016
    zotfile v3.03
  • Zotfile 3.1 is now under review with a some additional features and some bug fixes. At the same time, the zotfile website had to move from it's previous home to a new location. It's now available at www.zotfile.com and hosted by github pages so that others can contribute to the website as well (here).

    quickfold11: Yes, there is a hidden option for that. It actually was there before but not used consistently. See the 3.1 changelog.

    Olib170: Sorry, I don't think so.

    Makefile: Just updated the Makefile. It should now work on Mac OS and unix.

    jessriedel: Not sure but 3.1 might provide a solution. With the new user-defined wildcards, you can extract pretty much any information from Zotero metadata. But zotfile does not excess any information encoded in the pdf for renaming. So it's not going to work if that is what you need.

    apocrine: No, zotfile only supports the extraction of notes and highlights not text comments (I assume they are the once that directly appear on the pdf, right?)
  • Joscha: yes the text that you see directly on the pdf. Is there any plan to support extraction of them in the future?
  • No, that is not planned but a user contribution would be welcome.
  • edited January 29, 2014
    As Joscha's answer was not 100% negative, I'll try again ;-)

    it seems to be one of the major critiques of Zotero that it is not able to connect to an existing pdf storage (in terms of one directory, including sub-directories).
    I think with just some minor changes in Zotfile, one should be able (with some precautions) to do this with Zotfile.
    What I figured out I can do is to click right on an attached pdf file of a reference in Zotero and choose "Manage Attachments/Rename Attachments" (with Options to not rename and with a path pointing to my existing pdf directory and a subdirectory called "\%y").
    e.g. I try to move Busch.2013.pdf
    If this pdf is already existing, I will get in this moment a new file called "Busch2.pdf".
    I have looked in the sourcecode to find the code that will check if the the file is already existing and then rename the file and link. I think it should not be difficult (even though I'm not a java programmer), to modify the code so that if the file is already existing, the link will be created to this file.
    I would be quite willing to do this by changing the source code for the one time that I need to run this. Once I have moved/linked all my existing pdf with Zotero I would just revert back to the standard version of Zotfile.
    Could anybody give me a hand by telling me where in the source code I need to do the modifications ? I guess it must be in the "renameAttachment" function
    thanks in advance for any ideas
  • The attachment cannot be renamed if its extension is "caj", which is a file format used by the CNKI in China. Please support it, thanks!
  • In the Advance Settings tab of the Zotfile Preferences, you can add additional file types that should be renamed.
  • edited February 5, 2014
    Following up on Olib170's comment : I think the current behavior actually leads to a major issue. If You try to "Rename Attachment" on a file that has already been named and linked correctly, the link and file is iterated.

    Simple test: just rename the same file twice. This happens regardless of whether you're using Zotero's default formatting or set a custom file formatting.

    First time : foo/Baron and Kenny - 1986 - The moderator–mediator variable distinction in soc.pdf

    Second time : foo/Baron and Kenny - 1986 - The moderator–mediator variable distinction in soc2.pdf

    Third time: (same as the first, so I'm going to call this a "toggle" below)

    The real tragedy comes in that I suspect you can run into a race condition if you have Zotero open on multiple computers and end up Re-Renaming attachments. I ended up with a whole folder of citations that couldn't be found because they had toggled. I had to manually rename them (well, with rename 's/.pdf/2.pdf/') to fix it.

    If, as I think Olib170 suggests, you check to see if the current link is equal to the expected output name before adding the '2', it would eliminate the consequences of this condition.
  • "But zotfile does not excess any information encoded in the pdf for renaming."

    Ahh, yes. Reading the contents of the PDF would be a lot of additional work to implement for only a minor gain.

    Incidentally, the PayPal link is working again. Donation made. Thanks much!
  • Hi,

    the new Zotero beta (version 4.0.18-beta.r5+69179b6) adds support for links inside notes. While this works fine for web links, the pdf links that zotfile creates don't seem to open any pdfs (Report ID 2103210569). Is this a known bug?


  • works on Mac and Linux. I'm not sure Joscha ever got that working on Windows.
  • Following comment of krcrouse :
    Thanks for the additional test. This shows quite well where the problem lies, even outside of my own objective.
    So I agree with you that Zotfile should quite generally check if in the destination the expected output name does already exist, and if it does, link Zotero with this file.
    Thanks for considering this improvement
This discussion has been closed.