Zotero Beta integration with external note taking tools
The new PDF annotation and note editor are great! However, it seems to be difficult to integrate this setup (with annotations stored externally from the PDFs, and that seems to be difficult to directly export) closely with other note taking tools (Roam, Logseq, Obsidian, etc).
The following points would helpful:
- Web API access to all annotations made in the new PDF editor.
- This should include images from area highlights.
- Ideally a unique identifier for each annotation, so that new annotations on the same PDF file can be identified.
- A way to open the PDF editor on iOS etc via deep linking (zotero://...) at the position of the annotations.
Is some of that possible or even already planned for the near future?
The following points would helpful:
- Web API access to all annotations made in the new PDF editor.
- This should include images from area highlights.
- Ideally a unique identifier for each annotation, so that new annotations on the same PDF file can be identified.
- A way to open the PDF editor on iOS etc via deep linking (zotero://...) at the position of the annotations.
Is some of that possible or even already planned for the near future?
I've created an issue for the last one (though the first priority there will obviously be adding the new note editor on iOS and supporting the same type of annotation linking that's possible in the desktop beta).
- Regarding the web API docs, any chance that this will be documented soon? Would be fantastic to start playing with this. Coupling the new Zotero PDF annotator through Web API to Logseq/Roam etc would be a terrific combo.
- Is it already possible to open annotations on Linux/Windows/Mac through zotero:// links?
Would it be possible to get those PNG files also without going through the note export? There must be already some mechanism for generating the PNGs based on the PDF. It would be great if this could be somehow exposed as part of the Web API.
The alternative seems to be to download the PDF and extract image annotations by hand (maybe through pdf.js, or mupdf) whenever necessary, but it would be great if there were a way to avoid that.
For now, you can get the cached images from the desktop app using the JavaScript API. From Tools → Developer → Run JavaScript:
var item = ZoteroPane.getSelectedItems()[0];
var annotations = item.getAnnotations().filter(x => x.annotationType == 'image');
annotations.map(x => Zotero.Annotations.getCacheImagePath(x));
There's also code for turning those into data URIs if that's helpful.
To automate this locally, you could use the Better BibTeX plugin's debug-bridge to expose the JS API to your local system.
One more thing: Individual annotations are listed as "children" of the PDF file they annotate. However, when trying to request those children using the `/items//children` API request, I get an error
"""
UnsupportedParams:
Code: 400
URL: https://api.zotero.org/users/2558244/items/B4SVMJFF/children?format=json&limit=100
Method: GET
Response: /children cannot be called on attachment items
"""
Is there a way to make this work? The workaround is to search through ALL database items and filter those with the PDF file as a parent, which is of course extremely inefficient.
In the meantime, you can use '?itemType=annotation' to return all annotations, and use '?since=' and 'Last-Modified-Version' to retrieve only updated annotations since the last request.
Yes, I think a better API for integration with external note taking tools (Obsidian, Logseq, Roam) could be really useful both for Zotero and these tools, there are growing number of people who started using Zotero through the integration with these tools