Is there anyway I can open pdfs in Zotero pdf-viewer via the command line?
My workflow is:
- `Zotero`: name and manage citations
- `BetterBibtex`: to export bib file for use in `pandoc-markdown` based documents (`.md`, `.Rmd`).
- `Emacs`, `ebib`, and `pandoc-mode to write. I can jump to the BibTeX entry of a citation using `pandoc-mode`, which opens the BibTeX entry via `ebib`. `ebib` then allows me to open the associated PDF in an external PDF viewer.
Is there a way to open PDFs within the `Zotero` pdf-viewer via the command line without having to import the PDF into the `Zotero` database again?
Please let me know if you need more info about my question.
Thanks in advance.
Other relevant info:
ProductName: macOS
ProductVersion: 11.6.5
BuildVersion: 20G527
Zotero version: 6.0.10-beta.1+94372111f
- `Zotero`: name and manage citations
- `BetterBibtex`: to export bib file for use in `pandoc-markdown` based documents (`.md`, `.Rmd`).
- `Emacs`, `ebib`, and `pandoc-mode to write. I can jump to the BibTeX entry of a citation using `pandoc-mode`, which opens the BibTeX entry via `ebib`. `ebib` then allows me to open the associated PDF in an external PDF viewer.
Is there a way to open PDFs within the `Zotero` pdf-viewer via the command line without having to import the PDF into the `Zotero` database again?
Please let me know if you need more info about my question.
Thanks in advance.
Other relevant info:
ProductName: macOS
ProductVersion: 11.6.5
BuildVersion: 20G527
Zotero version: 6.0.10-beta.1+94372111f
open
command. E.g.:open zotero://open-pdf/library/items/3TACGQKH
But you'd have to know the item key at the end. @emilianoeheyns, the developer of Better BibTeX, would have to say whether there's anything BBT can do to help (e.g., pass the parent key through in the BibTeX entry in some unused field).
And I believe in the current version it will actually only work on the attachment item key, not the parent item key. We were going to expand it to function the same as double-clicking on the parent item, but I don't think we've merged that yet.
You can get the key of a stored file by doing Show File and looking at the folder name, or you can select the attachment in the items list and run this from Tools → Run JavaScript:
ZoteroPane.getSelectedItems()[0].key
The `uri` I get from the `Zutilo` add-on `Copy-Zotero-URIs` context menu item. I selected the attachment and got the correct identifier, and it does work as you described.
I wonder if @emilianoeheyns can provide more info on whether this is capable in `Better BibTeX`?
zotero://open-pdf/library/items/@citekey{ "attachment": "best" }
, it would return the first result fromgetBestAttachments
. I can't see whether I'm being called fromopen-pdf
though, so all relevant information must be in the key portion of the URL.getBestAttachment()
automatically if the key is for a regular item. We'll be changing the built-in zotero://open-pdf to do that.@
, as that is not passed to parseLibraryKey(/Hash); only the ID is. I do not know whether the user is trying to open the item itself or its best attachment, or even whether parseLibraryKey(/Hash) is called for URL handling at all. The only patch point I could find into the URL handling was parseLibraryKey(/Hash), and I have no context there. So all context needs to be in the ID, unless parseLibraryKey(/Hash) would be passed the URL too.