Zetoro 6, How to get current selected annotation metadata on reader?

Hi, my client is zotero 6.
I tried to develop a plugin for zetoro, the basic feature is to make the annotation to link another another annotation on some related pdf, so user can click and jump to related pdf directly.

Now I have troubles to do something.
First, I can't get the metadata about the annotation selected or clicked, I didn't find any api and functions that are available.
Second, I can't add context menu for annotation that right-clicked by mouse. I think it will be support on zetoro 7.

Any suggestions and replies would be gratifying.
  • You can use Actions&Tags plugin in Zotero 7. Use this script to get the item link for all types of items, including annotations: https://github.com/windingwind/zotero-actions-tags/discussions/115

    Note that some of the scripts provided there are for workflows outside of Zotero, so choose you link type accordingly. But using link in annotation fileds, such as notes or tags doesn't work for me. The hyperlinks are not shown in PDF reader tab.
  • @ulahcherubim, very appreciated, Because of you advice, I have upgraded my zotero to version 7.
    Now I know the metadata of the annotation, How can I open the pdf on reader and point to the page that annotation is located.
    I cant find the method for getting to pdf page that I want. On the note panel, I found that the "Show On Page" label when an annotation paste on note panel, If I click this label, then it will create a new reader tab for PDF and jump to the page annotation is located, This "Show on Page" feature is what I want, How to find the interface or function that it("Show On Page") offer.
    https://s3.amazonaws.com/zotero.org/images/forums/u11764939/omoui2yqmfxa8tk184ul.png
  • edited March 12, 2024
    In order to do that, you should:
    1. Install Actions and Tags plugin.
    2. Add this script into plugin,add a shortcut to it and check annotation menu while adding thr script. You should also add a label to it in order to find it later in the tree dot menu.(You can find instructions for this on the homepage of plugin's github repo.) https://github.com/windingwind/zotero-actions-tags/discussions/115
    3. Select the annotation and execute shortcut or select the corresponding label in the tree dot menu.
    4. Paste anywhere in notes or other program with an open link in anywhere functionality.
    5. Upon clicking, the link will take you directly to the annotation itself.
    If you need further assitance with this and can't get your head around via github documents, just ping me again in this thread.
  • edited March 12, 2024
    Hi, @ulahcherubim, I have followed your instructions exactly, But maybe I didn't describe it, let me describe my need.
    First, I have A_annotation that on A_PDF page, and it quotes a part of B_PDF; As shown below:
    https://s3.amazonaws.com/zotero.org/images/forums/u11764939/3r1g9geeb6sx41damwtx.png
    Second, I make B_annotation that on B_PDF, as you know, the B_annotation is the one quoted by A_annoatiaon textually, As show below:
    https://s3.amazonaws.com/zotero.org/images/forums/u11764939/m2o64sc5ni0ht1wrquhr.png
    Third, I try to add a hyperlink to A_annotation, and this hyperlink is point to B_annotation, so I can click the label when right-click A_annotation, then it will jump to the B_PDF and the position annotation is located. As Show below
    https://s3.amazonaws.com/zotero.org/images/forums/u11764939/l1b6u55hfc8ahsvg8bd6.png

    this feature can binding the relationship between two related references.
  • edited March 14, 2024
    I find that the relations field of annotation metadata, example below:
    ```json
    [
    "0": {
    "key": "4ZJ6FJXV",
    "version": 2468,
    "itemType": "annotation",
    "parentItem": "255HN5RN",
    "annotationType": "highlight",
    "annotationAuthorName": "",
    "annotationText": "5.1.4.4 电容耦合要求",
    "annotationComment": "",
    "annotationColor": "#aaaaaa",
    "annotationPageLabel": "9",
    "annotationSortIndex": "00008|000412|00574",
    "annotationPosition": "{\"pageIndex\":8,\"rects\":[[68.604,246.586,174.372,267.047]]}",
    "tags": [],
    "relations": {},
    "dateAdded": "2024-03-11T03:29:36Z",
    "dateModified": "2024-03-11T03:29:36Z"
    }
    ]
    ```
    This field is suitable for storage the location data of B_annotation.
    So The only problem is how to achieve the jump feature like "Show On Page" label
  • The text being not clickable in annotation note or tags fields is about how the program is structured. I assume that is not so hard to implement links working in annotation notes and tags, since it is already working on normal notes and tags.(the caveat might be creating a note from annotations but idk) If you need this feature to work, try pinging dstillman for an answer.
  • edited March 12, 2024
    @dstillman Can you provide some support or advice? I already know the annotation metadata, something like "key", "parentitem", "annotationPageLaber"...etc, Now I how to open a PDF file and jump to the annotation.
Sign In or Register to comment.