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.
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 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
No, I did not find a solution yet. If anyone has one, I'd be happy to hear it...:-)
Best,
Bart.
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 = {"
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.
Hopefully there'll be a solution.
Best,
Bart.
Import doesn't work and group couldn't handle linked files.
There is really no solution for now?
Thanks
Mel
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.
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.
Best, Stephan
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.
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.
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).
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
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...