unable to add list of annotations using addAnnotationsInPDF

New Here ,
Apr 29, 2022 Apr 29, 2022

Copy link to clipboard

Copied

Dear all, when I add single annotation , the annotation is display correctly, However, when I add a list of annotations, only 1 annotation is generated. There is seem to be no error message. Please advice. Thank you very much

Views

121

Likes

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 Expert ,
Apr 29, 2022 Apr 29, 2022

Copy link to clipboard

Copied

Can you share your code as well as the annotation JSON.

Likes

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
New Here ,
Apr 29, 2022 Apr 29, 2022

Copy link to clipboard

Copied

LATEST

const listOfAnnotations = [annotations2,annotations];

const annotations = [

        {

                "@context": [

                        "https://www.w3.org/ns/anno.jsonld",

                        "https://comments.acrobat.com/ns/anno.jsonld"

                ],

                "type": "Annotation",

                "id": "02dcf931-d1cb-49c1-a8bc-d047892a06bx",

                "bodyValue": "test annotation!",

                "motivation": "commenting",

                "stylesheet": {

                        "type": "CssStylesheet",

                        "value": "body-value-css { font: 14px Helvetica; color: #FF1317; }"

                },

                "target": {

                        "source": "77c6fa5d-6d74-4104-8349-657c8411a834",

                        "selector": {

                                "node": {

                                        "index": 1

                                },

                                "subtype": "freetext",

                                "boundingBox": [

                                        40.93206278800542,

                                        640.5534810103544,

                                        151.24050318279967,

                                        654.4287565317122

                                ],

                                "strokeColor": "#FF1317",

                                "styleClass": "body-value-css",

                                "type": "AdobeAnnoSelector"

                        }

                },

                "creator": {

                        "id":"RAY",

                        "name":"RAY",

                        "type":"Person"

                },

                "created": "2021-01-20T14:47:37Z",

                "modified": "2021-01-20T14:47:37Z"

        }

];

const annotations2 = [

        {

                "@context": [

                        "https://www.w3.org/ns/anno.jsonld",

                        "https://comments.acrobat.com/ns/anno.jsonld"

                ],

                "type": "Annotation",

                "id": "02dcf936-d1cb-49c1-a8bc-d047892a06bx",

                "bodyValue": "annotationXX",

                "motivation": "commenting",

                "stylesheet": {

                        "type": "CssStylesheet",

                        "value": "body-value-css { font: 14px Helvetica; color: #FF1317; }"

                },

                "target": {

                        "source": "77c6fa5d-6d74-4104-8349-657c8411a834",

                        "selector": {

                                "node": {

                                        "index": 0

                                },

                                "subtype": "freetext",

                                "boundingBox": [

                                        74.75303611351828,588.2804485559178,219.86187092211256,602.351608294933

                                ],

                                "strokeColor": "#FF1317",

                                "styleClass": "body-value-css",

                                "type": "AdobeAnnoSelector"

                        }

                },

                "creator": {

                        "id":"RAY",

                        "name":"RAY",

                        "type":"Person"

                },

                "created": "2021-01-20T14:47:37Z",

                "modified": "2021-01-20T14:47:37Z"

        }

];

function addAnnotationList(){

        var adobeDCView = new AdobeDC.View({

                clientId: adbClientId,

                divId: "embeddedView"

        });

        // Show the file

        var previewFilePromise = adobeDCView.previewFile(

                {

                        content: { promise: fetchPDF(urlToPDF) },

                        metaData: { fileName: uuidv4()+".pdf" , id: "77c6fa5d-6d74-4104-8349-657c8411a834"}

                },

                viewerOptions

        );

        previewFilePromise.then(adobeViewer => {

                adobeViewer.getAnnotationManager().then(annotationManager => {

                annotationManager.addAnnotationsInPDF(listOfAnnotations)

                        .then(() => console.log("Success"))

                        .catch(error => console.log(error));

                });

        });

}

Likes

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