Export the pdf key for an item using better bibtex
I plan to create links to open item and attached pdf on the browser.
Now I can export the item key and create link.
This is the post script in Better Bibtex
if (Translator.BetterBibLaTeX ) {
reference.add({ name: 'zotero-item-key', value: item.itemKey })
}
and link of zotero item: zotero://select/library/items/CPVM5SYM
However, the zotero://open-pdf/library/items/ requires the key of pdf file which is different from item key.
How could I export the key of pdf (if available) which attached to an item?
Now I can export the item key and create link.
This is the post script in Better Bibtex
if (Translator.BetterBibLaTeX ) {
reference.add({ name: 'zotero-item-key', value: item.itemKey })
}
and link of zotero item: zotero://select/library/items/CPVM5SYM
However, the zotero://open-pdf/library/items/ requires the key of pdf file which is different from item key.
How could I export the key of pdf (if available) which attached to an item?
if (Translator.BetterBibLaTeX ) {
const date = Zotero.BetterBibTeX.parseDate(item.date);
reference.add({ name: 'year', value: `${date.year}`});
reference.add({ name: 'zotero-key', value: item.itemKey });
if (zotero.attachments && zotero.attachments.length) {
for (const att of zotero.attachments) {
if (att.contentType == "application/pdf") {
reference.add({name:'zotero-pdf-key', value:att.itemKey});
break;
}
}
}
}