BibTex (and other bibliographic) import: Adding PDFs as links instead of attachments

Dear all,

As a new Zotero user, coming from JabRef, I'd like to import my BibTex-files into Zotero. Specifically, I'd like to add the PDFs that are referred to from this bibtex-file to my Zotero library as links, i.e., all PDFs are in one folder (the Base directory, specified in Zotero Preferences).

In bibtex, files are specified using the "file" field as follows:
...
file = {Albeck1991.pdf:Albeck1991.pdf:PDF},
...
which refers to Alback1991.pdf, which resides in the base directory.
If I import the bibtex-file, all these PDFs are imported as attachments, and copied to the Zotero Data directory, whereas I'd like Zotero to only add a link to them.

What I've tried already:
My first thought was to edit the BibTex.js translator file, and, one way or another, tell Zotero to interpret the "file" field as a link. However, as far as I can see, I cannot pass a linkMode attribute from a translator directly.
(e.g. item.attachments.push({path:filepath, mimeType:"application/pdf", title:filetitle, linkMode:"linked_file"}); does not work).
I've been searching through the Zotero code for clues, and came across translate_item.js
Under saveAttachmentFile some if-clauses determine the effective linkMode. However, I see no way how a local PDF file can end up with linkMode = "linked_file". If its location is specified as "path", it'll be an imported_file, whereas if it is specified as "url", it is automatically converted to "file" and again end up as an imported_file.

Is there any way to accomplish this? Would it be an idea to change translate_item a little, so that a translator can specifically indicate the linkMode?
I should mention that I'm not an experienced JavaScript programmer. I do, however, have some basic programming experience in Python and quite some in MATLAB.

Related topics:
https://forums.zotero.org/discussion/2142/possible-to-import-pdfs-as-links-not-copies/
https://forums.zotero.org/discussion/18052/ris-import-link-not-file/

Version: Zotero Standalone 4.0.6

Thanks for your thoughts.

Best wishes,
Bart Spronck.
  • (I don't have a solution, but web translators have a snapshot: false option for attachment that saves just a link. I don't think that works, but I don't see why that shouldn't be implemented for import translators)
  • As far as I can see, there is a snapshot:false option for import translators, but this does not affect locally imported PDF files... (in fact, I tried also with an online PDF and an online HTML-page, which both are always added as a link, regardless of snapshot:true/false)
  • Do you find a solution?
    I also want to import around 2000 items+pdf but keeping the filename and their emplacement (so briefly, I need just "link to file")
    I try extension Zutilo. It could do it, as you can change the attachment path. But it's unusable to me as my files are in differents folders, so each of them should be import one by one to avoid some "loss in translation". Not sure it will works well on large scale.
    So basically, I'm still looking for a solution.
    Thanks
  • Hey mel47,

    No, I did not find a solution yet. If anyone has one, I'd be happy to hear it...:-)

    Best,
    Bart.
  • edited May 24, 2013

    In bibtex, files are specified using the "file" field as follows:
    ...
    file = {Albeck1991.pdf:Albeck1991.pdf:PDF},
    ...


    Since all the files are in the same directory, could you throw file in text editor and do a search and replace?

    "file = {C:\MyDirectory\" for "file = {"
  • The files would still be imported into Zotero storage directory. That will not work as a solution for what the OP wants to do.

    I opened up a ticket for this. We would like to avoid putting this into a hidden preference, since most people will never come across it. So we're brainstorming on where to put this option.
  • Thanks for opening a ticket, aurimas!
    Hopefully there'll be a solution.

    Best,
    Bart.
  • I don't want to be annoying but I still didn't find how I can share to someone else my library with linked files.
    Import doesn't work and group couldn't handle linked files.
    There is really no solution for now?
    Thanks
    Mel
  • I have a similar problem. My goal is to be able to edit my database both in Zotero and in Jabref, using the bibtex as an intermediary format, and that is only doable if zotero won't be trying to import all the files over and over.

    The only response on GitHub so far was that it's only doable through a platform-specific code and not worth the effort. I'm not sure whether the problem is the checkbox or this functionality as such, but it definitely would be worth the effort. This would make it possible to use both Zotero and JabRef or other bibtex managers, whichever works better in a given situation.

    This would be welcome not only to LaTex people, who are still select few, but to the thousands of Android users. Zandy is unfortunately not making any progress about attachments, and its offline capabilities are limited at best. But we could use RefMaster, and be able to edit the database and view all the attachments. So implementing file link import would definitely be worth the effort.
  • Regardless of the link issue, going back and forth between JabRef and Zotero won't really work anyway. You'd constantly have to import and export in Zotero, which
    means
    a) you'll lose data because the two formats don't translate 1:1
    b) word processor integration won't work properly
    c) syncing is essentially out of the question as the items will be a assigned a new ID on each import

    Of course, you may still decide to do it, but it's certainly not a workflow that will play any role in terms of implementing a feature in Zotero or not.

    FWIW, for just editing database and accessing pdfs, Zotero's mobile site is pretty good. The big downside - what, among other things, ZotPad solves on the iPad, is that you can't edit and quickly re-attach items, so it's of little use for annotation. For that you're currently best of using Zotfile.
  • edited July 10, 2013
    I'm also very interested in a solution for that problem. Thanks for bringing that up.

    Best, Stephan
  • Another +1. The inability to do this has kept me from switching from BibDesk to Zotero for years.
  • edited February 13, 2015
    Wow! now 2 years have passed and still no solution for the 'link to .pdf' problem. :_(

    I find Zotero is an amazing tool, really, but I have the feeling the developers are not keen enough on such important commentaries like deef's one: "this has kept me from switching from BibDesk to Zotero for years". A single feature that is so critical that prevents a person from switching from one application to another.

    Something similar happens with the 'watch folder' feature.
    khazei states: "without these features I have to move to Mendeley"
    see:
    https://forums.zotero.org/discussion/15859/
    (though they mean zotfile plugin can solve it. I am still trying.
    https://forums.zotero.org/discussion/22267/save-to-zotero-and-automated-import-from-finder/
    )

    Can it be that developers are not having the right priority list?

    I wish you best success and when these two features are there, please tell me and I will switch gladly to Zotero.
  • Can it be that developers are not having the right priority list?
    There are many features requested that the developers would like to see as well, but for which the small team simply doesn't have the time to implement them.

    Everybody has a different list of 'deal-breakers', and saying you can't use Zotero without your favorite feature is just not the best negotiation tactic. Things that would make a significant difference is contributing your own patches, (crowdfunding) bounties for specific features, or subscribing to Zotero File Storage to finance Zotero development.
  • You could see whether http://zotplus.github.io/link-local-files/index.html does something (close to) what you want (FD: I am the author of it)
  • I was struggling with exactly the same issue (moving from EndNote). Was quite disappointed when I realized there is no supported way how to migrate my pdf links as actual links.

    At the end I solved it by connecting to zotero.sqlite file as to db and updated automatically all attachments as I needed. It is not the way I hoped for, but with a bit of programming background it is relatively straightforward (I used F# + SqlProvider).
  • Hi,
    any news to that issue? I need to import a BibTeX collection with links to pdf files. There are several hundreds of entries with pdf links, so doing all the links by hand is not an option. Since I want the BibTeX metadata associated with the pdf file, I cannot use multiple links for one entry.
    Thanks, Matthias
  • There's been no update on this that I'm aware of.
  • edited February 7, 2018
    Thanks for clarifying.
    For those who are interested: I think there might be a workaround. It consists in using the ZotFile plugin to turn the attached pdfs into links. Not very elegant since the pdfs are first copied to the Zotero database, then deleted and moved to another location. If it is the original location, they would be duplicated with a different name (renaming can principally be turned off, but apparently not in this case). There may be a more elegant way doing this, I am quite new to Zotero and might be missing something...
  • I think ZotFile is likely currently the only way of doing this without significant coding (such as the sqlite option mentioned above), yes.
  • An import option to link to files is now available in Zotero 5.0.61.
Sign In or Register to comment.