ZotFile - Advanced PDF management for Zotero

edited July 13, 2017
NOTE: Zotfile 5 for Zotero 5 is now online and the webpage was updated with instructions how to install version 5. Just go to the zotfile webpage www.zotfile.com.

ZotFile is a Zotero plugin to manage your attachments: automatically rename, move, and attach PDFs (or other files) to Zotero items, sync PDFs from your Zotero library to your (mobile) PDF reader (e.g. an iPad, Android tablet, etc.) and extract annotations from PDF files.

See zotfile webpage for more information.

DONATION
If you are using this add-on, please consider a donation through paypal. Just go to the webpage above and click on 'donate'.

Attach New Files to Zotero Items
ZotFile can rename and add the most recently modified file from the Firefox download or a user specified folder as a new attachment to the currently selected Zotero item. It renames the file using metadata from the selected Zotero item (user configurable), and stores the file as a Zotero attachment to this item (or alternatively, moves it to a custom location).

(Batch) Rename and Move Attachments based on Zotero Metadata
The user can also select any number of Zotero items and automatically rename and move all attachments of these items according to the user defined rules using metadata of the respective zotero item (batch processing).

Sync PDFs with your iPad or Android tablet
To read and annotate PDF attachments on your mobile device, zotfile can sync PDFs from your Zotero library to your (mobile) PDF reader (e.g. an iPad, Android tablet, etc.). Zotfile sends files to a location on your PC or Mac that syncs with your PDF reader App (PDF Expert, iAnnotate, GoodReader etc.), allows you to configure custom subfolders for easy access, and even extracts the annotations and highlighted text to Zotero notes when you get the files back from your tablet. For instruction, click here.

Extract Annotations from PDF Files
After highlighting and annotating pdfs on your tablet (or with the PDF reader application on your computer), ZotFile can automatically extract the highlighted text and note annotations from the pdf. The extracted text is saved in a Zotero note. Thanks to Joe Devietti, this feature is now available on all platforms based on the pdf.js library.
«13456763
  • Hi

    There is a small bug in this software. If the filename extension is in upper case (file.PDF) it is not included.

    This can be fixed by changing line 182 of zotfile.js from

    var filetype=this.getFiletype(file.leafName);

    to
    var filetype=this.getFiletype(file.leafName).toLowerCase();

    For those that want to do this fix themselves, the file is located under your firefox profile. On my mac the path is

    ~/Library/Application Support/Firefox/Profiles/l5auep3s.Mikko/extensions/zotfile@columbia.edu/chrome/content/zotfile/zotfile.js


    Mikko
  • With the proposed fix, the file name extension still stays upper case. A better fix would be to change line number 158

    from
    return(temp[temp.length-1]);

    to
    return(temp[temp.length-1].toLowerCase());

    Mikko
  • After testing this great plugin for a while I ended up accidentally attaching a wrong file several times. This can happen if you have downloaded more files after the one that you want to attach.

    One possible solution to this issue would be a confirmation dialog. This can be done by adding the following on line 240. (You also need to add the closing bracket) This could be made optional at the settings, but would be a good feature for the next release.

    if(confirm("Do you want to rename and link file \'" + lastfile_oldpath + "\' to the currently selected Zotero item?")){


    Mikko
  • I did some changes and now this is just the perfect plugin for my needs
    -makes filename extension lower case
    -asks for a confirmation before attaching a file
    -attaches the file as a zotero attachment instead of linked file

    The content of my modified zotfile.js can be found here

    http://pastebin.com/f4c187307

    Mikko
  • That's great, Mikko. Thanks!
    Do you mid if I add this stuff to zotfile? I thought about providing two further options through about:config: a) whether people want to be ask for a confirmation and b) whether they want to link or attach the file to zotero.
    Can you also point me at the changes for attaching files? Are these two lines all the changes?
    Zotero.Attachments.importFromFile(lastfile, item.itemID);

    //Delete the old file that is not longer needed
    lastfile.remove(false)
  • Feel free to use the code anyway you like.

    A diff of the original and my additions can be found at http://pastebin.com/mda4b42c The changes are also now highlighted in the code I posted http://pastebin.com/m618943b

    I did three things
    1) Added toLowerCase in the function that gets the file name extension
    2) Added a confirm dialog and enclosed the code for copying the file and creating the Zotero attachment inside an if-block
    3) Changed the linkFromFile to importFromFile and added a command to remove the extra file since importFromFile makes a copy of the original

    Mikko


    Mikko
  • edited July 12, 2012
    Hi, I have updated the plugin with Mikko's suggestions.

    http://jlegewie.com/zotfile.html

    The changes:

    1) confirm dialog (you can turn this of with the confirmation option)
    2) You can now decide whether you want to link or import the file (.import option). Zotfile either creates a link (.import=false) to the renamed file (which means that the file remains in the dest_dir) or imports the file so that Zotero stores a copy if it (in this case the file at dest_dir is deleted).
    3) small bug fixed
  • Nice plugin!

    Would it be possible to use journal abbreviation instead of journal (and journal if no abbreviation exist)? The idea would be to have shorter file names with the same information, and should work well in natural sciences.

    Also; white spaces in the filename elements (author, journal ect) should be replaced with _ imho - or hopefuly the option given

    Shame that import dosent work in linux... Minor flaw I can live with :-D

    Keep up the nice work!
  • I love this plugin, and would like to thank Joscha for creating it.

    Just one tiny request, please: In the renaming process, underscores are not inserted before, between, and after the words "et al". This is slightly inelegant, since underscores are used instead of spaces elsewhere, and it also messes up the directory listing (Bloggs et al comes before Bloggs_2000). Do others agree, and, if so, could it be fixed, please?

    Thanks again -- this is a great addition to Zotero!
  • I found a small bug in the plugin that causes the Zotfile button to disappear.

    On OS X and Firefox 3.1, do the following:
    1) Open firefox
    2) Open zotero
    3) From file menu, choose "open new window"
    4) Open zotero in this new window - Zotfile icon does not show

    Mikko
  • this is a cross-platform bug. Also true in Linux.
    (where, by the way, the import function doesn't work either (attachment never worked). Josua has tried his best, but if anyone else wants to take a shot?
  • hey,

    stervbo and Keith: I have uploaded a new version which allows you to a) use journal abbreviation ('%s' in the renameFormat option), b) replace blanks with underscores '_' (option: replace_blanks), and c) change the string which is added after the first author if the option 'add_etal=true' (option: 'etal' - default is " et al" so that the same filenames are produced as before. You can just replace this with "_et_al" and get the desired result).

    mronkko: There are several people who have reported problems with the zotfile button. Your description is very helpful because it's easy to reproduce the bug. The problem is that my knowledge about the XUL language (Firefox User Interface Language) is very limited (for the interface part (the button), I just copied the interface code from lytero). So I have no idea where the bug comes from. I would be happy if anyone is willing to help.
  • Have you tried asking Mozilla developer forums?

    http://forums.mozillazine.org/viewforum.php?f=19

    Mikko
  • This seems great, but what I'd really like is something a little different. I already have hundreds of PDFs sitting on my HD and it would take days to import them into Zotero by finding the matching titles and re-importing them. Since almost all these files are already named with the relevant meta-data, I'd like to be able to have a plugin which attempts to match these PDFs to existing citations and then imports them to Zotero.

    A second feature I'd like is similar to what Sente can already do - where when there is no matching citation you can do a search based on data in the PDF file itself: DOI if there is one, or author/title information, and then to create a new entry at the same time as importing the PDF. (See the Sente website for short videos showing how this works.)
  • If you just add the PDFs to zotero & they can be indexed, then you can right click & choose to retrieve metadata for the pdf. It will look on Google scholar for the information.

    It is planned to expand this to use other methods of retrieving PDF metadata (such as through DOIs).
  • kerim: I have exactly the same problem and I am working on a solution of reading the author and title information from a PDF. More information here

    http://forums.zotero.org/discussion/6129/translators-for-pdfs/


    Mikko
  • I have a small enhancement proposal. The future versions of Zotfile could use Zotero functions to create the filenames instead of implementing another mechanism to determine the name for the PDF.

    Replace this line
    filename=this.createFilename(item, rename_rule);

    with this one
    filename=Zotero.Attachments.getFileBaseNameFromItem(item.itemID);

    After this the function createFilename and the associated preferences can be removed.

    Mikko
  • Works like a charm with my portableFirefox 3.07 on windows xp, using networkdrives. Really nice plugion!
  • edited March 23, 2009
    I think the source_dir option is not a good method. Why can't zotfile automatically find where the pdf file is?
  • how would it tell? What is "the" pdf file?
  • edited March 23, 2009
    Sorry. After I reread the description of zotfile, I realized I had a misunderstanding about the use of zotfile. I thought zotfile could rename, move, and attach files in the zotero collection.
  • Thanks for responding to my request Joscha. This is really is an excellent addition to Zotero.
  • This does not seem to work with Linux. Moving the file causes some kind of error.

    I created a patch that can be used to replace one code block to get the import functionality working on linux. Linking does not work with this.

    http://rafb.net/p/F69oo111.html

    Mikko
  • thanks mikko - that would be great but can't get the link to work - I get a 404...
  • All - This plug-in is great, but I seem to be having a small issue - my renamed.pdf files end up in the Zotero storage location (ie D:\Kari\JournalLibrary\ElbePapers\storage\KATT7DG2), and not the dest_dir I have set in about:config. I'd greatly appreciate any insight into how to remedy this.

    thanks!
  • There is a preference called zotfile.import or something similar. Change this to false.
  • Nice plug in. Thanks Joscha and contributors.

    Any chance that this could work with drag-and-drop as well? I would like to drag the URL of the PDF from the journal web page onto the citation, and then it gets downloaded, renamed, saved and synced. Wow! That would be so cool. Save the annoyance of browsing to the "zotfile import folder".
  • That's a nice idea but I wont be able to do it in the near future.
    But maybe this helps: I never have to browse to the "zotfile import folder" because I use a default download folder (which you can set on firefox's main preference tab) so that files always first go to a specific folder. This folder is also my "zotfile import folder". Accordingly, I can just press the zotfile icon without browsing to the "zotfile import folder".
  • Hi, I am happily using zotfile for a few weeks, and now today the paper clip icon has suddenly disappeared. I see that JM had this problem early. Is there yet any explanation for this? I did try re-installing zotfile, but no dice.
  • I may have answered my own question, in part.

    1) If you start up a fresh firefox, the icon is there.
    2) If you create a new window, there is no icon in the second window. But I still have an icon in the first window.
    3) If you close the first window, voila! No paper clip in my firefox.

    I will keep investigating, but I think I am close...

This is an old discussion that has not been active in a long time. Before commenting here, you should strongly consider starting a new discussion instead. If you think the content of this discussion is still relevant, you can link to it from your new discussion.

This discussion has been closed.