• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Annotation selector is not valid for given {id}

Explorer ,
Sep 30, 2022 Sep 30, 2022

Copy link to clipboard

Copied

Hi, 

I've encountered this error when using 

annotationManager.addAnnotations(annotations);

 It is really difficult to debug because it works fine on a PDF, until you add a certain annotation and then it stops working. From my best guess It seems to happen when the quadPoints contain more than 20+ items.

I will paste my full source code below.

Please advise urgently.

Kind regards

<script>
var document_data = [{
  "@context": [
    "https://www.w3.org/ns/anno.jsonld",
    "https://comments.acrobat.com/ns/anno.jsonld"
  ],
  "id": "4ababa2a-2de5-8e18-b0h9-c85939ab8a4",
  "type": "Annotation",
  "motivation": "commenting",
  "bodyValue": "hi",
  "target": {
    "source": "6d07d124-ac85-43b3-a867-36930f502ac6",
    "selector": {
      "node": {
        "index": 0
      },
      "opacity": 0.4,
      "subtype": "note",
      "boundingBox": [
        578,
        825,
        595,
        842
      ],
      "strokeColor": "#fccb00",
      "type": "AdobeAnnoSelector"
    }
  },
  "creator": {
    "id": "LMF-2",
    "name": "LMF-2",
    "type": "Person"
  },
  "created": "2022-09-30T08:55:18Z",
  "modified": "2022-09-30T08:55:18Z"
},{
  "@context": [
    "https://www.w3.org/ns/anno.jsonld",
    "https://comments.acrobat.com/ns/anno.jsonld"
  ],
  "id": "ebb99746-af83-8d67-55h1-9adbc9ac8a4",
  "type": "Annotation",
  "motivation": "commenting",
  "bodyValue": "hi2",
  "target": {
    "source": "6d07d124-ac85-43b3-a867-36930f502ac6",
    "selector": {
      "node": {
        "index": 0
      },
      "quadPoints": [
        90,
        684,
        506,
        684,
        90,
        671,
        506,
        671,
        90,
        671,
        385,
        671,
        90,
        657,
        385,
        657
      ],
      "opacity": 0.4,
      "subtype": "highlight",
      "boundingBox": [
        90,
        684,
        385,
        657
      ],
      "strokeColor": "#fccb00",
      "type": "AdobeAnnoSelector"
    }
  },
  "creator": {
    "id": "LMF-2",
    "name": "LMF-2",
    "type": "Person"
  },
  "created": "2022-09-30T08:55:38Z",
  "modified": "2022-09-30T08:55:38Z"
},{
  "@context": [
    "https://www.w3.org/ns/anno.jsonld",
    "https://comments.acrobat.com/ns/anno.jsonld"
  ],
  "id": "87b29110-8be8-813f-4bh3-c919ba82981",
  "type": "Annotation",
  "motivation": "commenting",
  "bodyValue": "",
  "target": {
    "source": "6d07d124-ac85-43b3-a867-36930f502ac6",
    "selector": {
      "node": {
        "index": 0
      },
      "quadPoints": [
        309.9162011173185,
        739.3463687150838,
        505.44692737430177,
        739.3463687150838,
        309.9162011173185,
        725.659217877095,
        505.44692737430177,
        725.659217877095,
        89.9441340782123,
        725.659217877095,
        505.44692737430177,
        725.659217877095,
        89.9441340782123,
        711.9720670391062,
        505.44692737430177,
        711.9720670391062,
        89.9441340782123,
        711.9720670391062,
        306.9832402234637,
        711.9720670391062,
        89.9441340782123,
        698.2849162011173,
        306.9832402234637,
        698.2849162011173
      ],
      "opacity": 0.4,
      "subtype": "highlight",
      "boundingBox": [
        309.9162011173185,
        739.3463687150838,
        306.9832402234637,
        698.2849162011173
      ],
      "strokeColor": "#fccb00",
      "type": "AdobeAnnoSelector"
    }
  },
  "creator": {
    "id": "LMF-2",
    "name": "LMF-2",
    "type": "Person"
  },
  "created": "2022-09-30T09:04:59Z",
  "modified": "2022-09-30T09:04:59Z"
},];

const annotations = document_data;
        
/*
Copyright 2020 Adobe
All Rights Reserved.

NOTICE: Adobe permits you to use, modify, and distribute this file in
accordance with the terms of the Adobe license agreement accompanying
it. If you have received this file from a source other than Adobe,
then your use, modification, or distribution of it requires the prior
written permission of Adobe.
*/

var viewerConfig = {
    /* Enable commenting APIs */
    enableAnnotationAPIs: true,  /* Default value is false */
    embedMode: "FULL_WINDOW",
};

/* Wait for Adobe Document Services PDF Embed API to be ready */
document.addEventListener("adobe_dc_view_sdk.ready", function () {
    
    const eventOptions = {
        listenOn: [
            "ANNOTATION_ADDED", "ANNOTATION_CLICKED",
            "ANNOTATION_UPDATED", "ANNOTATION_CLICKED",
            "ANNOTATION_DELETED", "ANNOTATION_CLICKED",
        ]
    }
                 
    const profile = {
       userProfile: {
           name: 'LMF-2',
       }
   };
    /* Initialize the AdobeDC View object */
    var adobeDCView = new AdobeDC.View({
        /* Pass your registered client id */
        clientId: "removed_for_security",
        /* Pass the div id in which PDF should be rendered */
        divId: "adobe-dc-view",
    });

    /* Invoke the file preview API on Adobe DC View object and return the Promise object */
    var previewFilePromise = adobeDCView.previewFile({
        /* Pass information on how to access the file */
        content: {
            /* Location of file where it is hosted */
            location: {
                url: "https://some.domain.com/public/s3_files/uploadsPy3quFjSCSQF8vNJ4tOSCDWxlJhCfh8QAP1Kr0OG.pdf",
                /*
                If the file URL requires some additional headers, then it can be passed as follows:-
                header: [
                    {
                        key: "<HEADER_KEY>",
                        value: "<HEADER_VALUE>",
                    }
                ]
                */
            },
        },
        /* Pass meta data of file */
        metaData: {
            /* file name */
            fileName: "Py3quFjSCSQF8vNJ4tOSCDWxlJhCfh8QAP1Kr0OG.pdf",
            /* file ID */
            id: "6d07d124-ac85-43b3-a867-36930f502ac6"
        }
    }, viewerConfig);
    
    adobeDCView.registerCallback(
        AdobeDC.View.Enum.CallbackType.GET_USER_PROFILE_API,
        function() {
           return new Promise((resolve, reject) => {
              resolve({
                 code: AdobeDC.View.Enum.ApiResponseCode.SUCCESS,
                 data: profile
              });
           });
        },
    {});
    

    /* Use the annotation manager interface to invoke the commenting APIs*/
    previewFilePromise.then(function (adobeViewer) {
        
        adobeViewer.getAnnotationManager().then(function (annotationManager) {
            annotationManager.registerEventListener(
            function(event) {
                var status = true;
                for (let i = 0; i < annotations.length; i++) {
                  if(annotations[i].id == event.data.id){
                      status = false;
                  }
                }
                if(event.type == "ANNOTATION_DELETED" || event.type == "ANNOTATION_UPDATED"){

                    status = true;
                }
                // "ANNOTATION_UPDATED", "ANNOTATION_CLICKED",
                if(status) {
                    console.log(event);
                    console.log('qawsed');
                    var workflow_id = $('.workflow_id').val();
                    var document_data  = JSON.stringify(event.data, null, 2);
                    // var document_data  = event.data;
                    $.ajax({
                        url         : base_url+'/correspondence/pdf-comment-save',
                        type        : "post",
                        data: {
                            '_token'        : csrf_token,
                            'data'          : document_data,
                            'type'          : event.type,
                            'workflow_id'   : workflow_id
                        },
                        success     : function(data){
                            var response =  $.parseJSON(data);
                            if(response.status == true) {
                                showMessage('success',response.message);
                            } else {
                                showMessage('error',response.message);
                            } 
                        }
                    });
                }
                
            },
                eventOptions
            );
            /* API to add annotations */
            annotationManager.addAnnotations(annotations)
                .then(function () {
                    console.log("Annotations added through API successfully")
                })
                .catch(function (error) {
                    console.log(error)
                    // console.log('1');
                });

            /* API to get all annotations */
            annotationManager.getAnnotations()
                .then(function (result) {
                    console.log("GET all annotations", result)
                })
                .catch(function (error) {
                    console.log(error)
                    // console.log('2');
                });

            /* API to delete annotations based on annotation ID filter */
            var filter = {
                annotationIds: ["3adeae16-a868-4653-960e-613c048dddc5", "079d66a4-5ec2-4703-ae9d-30ccbb1aa84c"]
            };
            annotationManager.deleteAnnotations(filter)
                .then(function () {
                    console.log("Deleted annotations based on annotation ID filter.")
                })
                .catch(function (error) {
                    console.log(error)
                    // console.log('3');
                });

            /* API to delete annotations based on page range filter */
            filter = {
                pageRange: {
                    startPage: 4,
                    endPage: 6
                }
            };
            annotationManager.deleteAnnotations(filter)
                .then(function () {
                    console.log("Deleted annotations based on page range filter")
                })
                .catch(function (error) {
                    console.log(error)
                    // console.log('4');
                });

            /* API to get annotations after deletion */
            annotationManager.getAnnotations()
                .then(function (result) {
                    console.log("GET annotations result after deleting annotations", result)
                })
                .catch(function (error) {
                    console.log(error)
                    // console.log('5');
                });
        });
    });
});
</script>

Views

8.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 20, 2022 Oct 20, 2022

Copy link to clipboard

Copied

@Raymond Camden it would be really helpful if you can share a roadmap for this issue, then we don't have to check in every other day 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Oct 20, 2022 Oct 20, 2022

Copy link to clipboard

Copied

I can't share anymore now outside of the fact that engineering has it in their hands. I've asked for an update but don't have one yet.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 23, 2022 Oct 23, 2022

Copy link to clipboard

Copied

I used the solution provided by @Vasavi244971977sns in this thread and it worked. Hope this can help someone before the fix comes out.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Oct 24, 2022 Oct 24, 2022

Copy link to clipboard

Copied

As an update, engineering has been able to diagnose the issue, and it's closely related to what yall are seeing - not the SIZE of the quads but invalid sized ones. No ETA on a fix, but progress is being made. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 02, 2022 Nov 02, 2022

Copy link to clipboard

Copied

Hey @Raymond Camden ,

 

Any update on this issue?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 02, 2022 Nov 02, 2022

Copy link to clipboard

Copied

I can tell you, internally, work is being done. Not sure I'm allowed to say more so I'll shut up, but it's definitely being worked on.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 25, 2022 Nov 25, 2022

Copy link to clipboard

Copied

@Raymond Camden Any feedback?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 29, 2022 Nov 29, 2022

Copy link to clipboard

Copied

I think it may have been addressed. Try and see please.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

Hi @Raymond Camden It has not yet been resolved. Please advise. Kind regards

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

I'm checking - it was fixed, but may not be pushed to production yet.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 14, 2022 Dec 14, 2022

Copy link to clipboard

Copied

@Raymond Camden Could you find out if it was deployed to production?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Dec 15, 2022 Dec 15, 2022

Copy link to clipboard

Copied

The fix for this has been deployed to production, but note that bounding box coordinates must be correct.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

@Raymond Camden still encountering this issue..

{"source":"da5e2508-bab0-428d-7570-08dbdb2aec54","selector":{"node":{"index":0},"quadPoints":[136.32046054209644,620.0642840009594,714.1472775245862,620.0642840009594,136.32046054209644,610.2393859438714,714.1472775245862,610.2393859438714,136.32046054209644,610.2393859438714,722.7440633245383,610.2393859438714,136.32046054209644,599.8004317582154,722.7440633245383,599.8004317582154,136.32046054209644,599.8004317582154,776.7810026385225,599.8004317582154,136.32046054209644,589.3614775725594,776.7810026385225,589.3614775725594,136.32046054209644,589.3614775725594,469.13888222595347,589.3614775725594,136.32046054209644,578.9225233869033,469.13888222595347,578.9225233869033,223.5164307987527,589.3614775725594,749.7625329815304,589.3614775725594,223.5164307987527,578.9225233869033,749.7625329815304,578.9225233869033,136.32046054209644,578.9225233869033,695.7255936675463,578.9225233869033,136.32046054209644,568.4835692012473,695.7255936675463,568.4835692012473,136.32046054209644,568.4835692012473,168.25137922763253,568.4835692012473,136.32046054209644,558.0446150155913,168.25137922763253,558.0446150155913,178.69033341328856,568.4835692012473,490.6308467258336,568.4835692012473,178.69033341328856,558.0446150155913,490.6308467258336,558.0446150155913,136.32046054209644,558.0446150155913,704.9364355960662,558.0446150155913,136.32046054209644,547.6056608299352,704.9364355960662,547.6056608299352,136.32046054209644,547.6056608299352,469.13888222595347,547.6056608299352,136.32046054209644,537.1667066442792,469.13888222595347,537.1667066442792,241.32405852722476,547.6056608299352,731.9549052530583,547.6056608299352,241.32405852722476,537.1667066442792,731.9549052530583,537.1667066442792,136.32046054209644,537.1667066442792,735.6392420244663,537.1667066442792,136.32046054209644,526.7277524586232,735.6392420244663,526.7277524586232,136.32046054209644,526.7277524586232,773.0966658671144,526.7277524586232,136.32046054209644,516.9028544015351,773.0966658671144,516.9028544015351,136.32046054209644,516.2887982729671,744.8500839529863,516.2887982729671,136.32046054209644,506.4639002158791,744.8500839529863,506.4639002158791,136.32046054209644,506.4639002158791,469.13888222595347,506.4639002158791,136.32046054209644,496.0249460302231,469.13888222595347,496.0249460302231,223.5164307987527,506.4639002158791,744.8500839529863,506.4639002158791,223.5164307987527,496.0249460302231,744.8500839529863,496.0249460302231,136.32046054209644,496.0249460302231,754.0609258815064,496.0249460302231,136.32046054209644,485.58599184456705,754.0609258815064,485.58599184456705,136.32046054209644,485.58599184456705,727.0424562245144,485.58599184456705,136.32046054209644,475.147037658911,727.0424562245144,475.147037658911,136.32046054209644,475.147037658911,469.13888222595347,475.147037658911,136.32046054209644,464.708083473255,469.13888222595347,464.708083473255,241.32405852722476,475.147037658911,727.0424562245144,475.147037658911,241.32405852722476,464.708083473255,727.0424562245144,464.708083473255,136.32046054209644,464.708083473255,730.7267929959223,464.708083473255,136.32046054209644,454.2691292875989,730.7267929959223,454.2691292875989],"opacity":1.0,"subtype":"highlight","boundingBox":[136.32046054209644,620.0642840009594,776.7810026385225,454.2691292875989],"inkList":null,"strokeColor":"#F8D147","strokeWidth":0,"type":"AdobeAnnoSelector","styleClass":null}}

Here is the JSON of the target annotation being loaded. Its a highlight annotation.

Garrett28259082qfbf_0-1698987226278.png

 



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 03, 2023 Nov 03, 2023

Copy link to clipboard

Copied

All I can suggest is ensuring the bounding boxes are right. If you do, and the issue still remains, I'd need a reproducable case I can report internally, preferably an html file with the JS and everything all in that one file.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 03, 2023 Nov 03, 2023

Copy link to clipboard

Copied

If the bounding boxes are taken from the ANNOTATION_ADDED call, then Adobe must be providing improper bounding boxes. I don't do anything to modify them

But the bigger issue is: if I have one annotation out of 100 that fails, why does the entire call to add annotations fail? It should successfully insert valid annotations and throw an error for only the specific annotations that cannot be inserted, not fail the whole request

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 06, 2023 Nov 06, 2023

Copy link to clipboard

Copied

To your first question, I agree. Again, if you can provide a working sample I can run here, I can report it.

 

To your second - eh - it depends I guess. I could see supporting a status type response on every annotation that reports on whether or not it was added.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 07, 2023 Nov 07, 2023

Copy link to clipboard

Copied

Hey Raymond, thanks for getting back to me.

 

I'm unable to provide a copy of the document since it's proprietary. I am guessing this error happened because of a large area of a table being highlighted. About 20-30 other highlights were made on the same document and successfully were entered.

 

If there was a way to catch these errors either before they were inserted into the database, or at load time and skip them, it would be a lot better. I have no idea how to catch this error, and if I can't, my user doesn't see any annotations until I go into the database and delete the faulty one, where I don't even know which one is faulty without my client going into JS console.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 07, 2023 Nov 07, 2023

Copy link to clipboard

Copied

Can you reproduce it elsewhere? Sorry to push back, but I need something I can bring to engineering that clearly demonstrates the issue, and I'm not sure how to replicate it myself. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 12, 2023 Nov 12, 2023

Copy link to clipboard

Copied

I am having trouble reproducing it, I didn't make the annotation unfortunately. TBH, I think if the API still worked if an annotation failed, it would be a minor issue. Because it breaks all annotations, it's a much larger issue.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 22, 2023 Nov 22, 2023

Copy link to clipboard

Copied

@Raymond Camden I need an update on this, it's completely unnacceptable for Adobe to send me a bad JSON annotation body, tell me to send it back to them, and then deny it (AND ALL OTHER ANNOTATIONS THAT ARE SUCCESSFUL)

 

It's completely unusable and how does nobody see this as a problem.. is anybody even using annotations in production??

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 27, 2023 Nov 27, 2023

Copy link to clipboard

Copied

I don't have an update as I'm not able to file a bug for this w/o a repro case.  I do apologize for the delay - was off for Thanksgiving.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 27, 2023 Nov 27, 2023

Copy link to clipboard

Copied

Hope you had a nice Thanksgiving.. 

This is kind of a ticking time bomb situation for every developer.. 99.9% of annotations will work just fine, but then there is that one that Adobe returns bad boundingbox for (we dont touch the bounding box), and the whole document is ruined. Like I said, if 1 annotation did not fail every single other one, this would be an incredibly minor issue.

 

Because of the implementation, and the fact that every commnent is wiped from the document (unable to be added), its a major issue.

 

Can you please just escalate the failure on AddAnnotations call to only add successful annotations and return an error message with an array of ID that failed? That seems like it makes the most sense

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 27, 2023 Nov 27, 2023

Copy link to clipboard

Copied

I can file a report on this idea but have no power to escalate anything. I'll report this now, but honestly, as a change request, not a bug fix, I'd not expect an update this year. I know that's not what you would like to hear, but just being honest on what I expect.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 27, 2023 Nov 27, 2023

Copy link to clipboard

Copied

Can we classify the fact that AddAnnotations fails with 1 bad record as a bug, when in reality there could be infinite number of successful annotations?

That definitely does not seem like desired behavior, if one user messes up an annotation, then ruin the experience for every user on the document?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 27, 2023 Nov 27, 2023

Copy link to clipboard

Copied

As I said earlier, I _could_ see some people thinking that if I do N operations in one call and it fails, they want the entire thing to fail, like a transaction. I think in _this_ case, what you propose makes sense. Calling it a bug or ER at this point won't make it happen any quicker though. I did just file it FYI. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources