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?
  • This is exactly what is needed! Something similar to Kindle offers where highlights are able to be synced with readwise.io API or downloaded as markdown.
  • The first three already exist — annotations aren't yet documented in the web API docs, but Zotero itself syncs them via the API as a new item type.

    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).
  • Awesome, thanks! Two more questions:

    - 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?
  • It's unlikely we'll document anything before Zotero 6 is released, but there's nothing stopping you from playing with it now just by looking at API responses. You can ask specific questions on zotero-dev.
    Is it already possible to open annotations on Linux/Windows/Mac through zotero:// links?
    It's possible to open PDFs in the new PDF reader with zotero://open-pdf links but annotations aren't yet supported.
  • Excellent, thanks!
  • I checked the Web API in some more detail. It is possible to get text annotations, but area highlights/image annotations come only with information about the position of the annotation box. The images themselves seem to be only generated when exporting the annotations as a note. Those can then be downloaded via Web API as PNG files.

    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.
  • Image annotation images are generated and cached locally based on the needs of the consuming app (desktop, iOS, etc.). It's possible we'll make them available via the API when we add the PDF reader to the web library, but I can't guarantee 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.
  • Thanks!

    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.

  • I've added an issue for that.

    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.
  • >t's possible we'll make them available via the API when we add the PDF reader to the web library, but I can't guarantee that.

    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
Sign In or Register to comment.