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

Unable to update boundingBox for Note Annotations

Community Beginner ,
Jan 31, 2024 Jan 31, 2024

Copy link to clipboard

Copied

There appears to be an issue with Note Annotations boundingBox not being updated. When I try to use the updateAnnotations method with an Note where the only change is the bounding box an error is thrown saying there is nothing to update. 

In the docs it specifically says this is possible for note annotations, but I only get the error message.
https://developer.adobe.com/document-services/docs/overview/pdf-embed-api/howtos_comments/#updateann...

 

I can provide more information if necesarry. Please let me know how to resolve this.

Views

274

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

correct answers 1 Correct answer

Community Beginner , Feb 02, 2024 Feb 02, 2024

Appending a space to the bodyValue fixed the issue I had. It appears bounding boxes can only be updated if the text is modified. Note movement is now syncing correctly and the bounding box check is working correctly. Thanks for the help @Joel_Geraci !

Votes

Translate

Translate
Community Expert ,
Jan 31, 2024 Jan 31, 2024

Copy link to clipboard

Copied

Can you show your code?

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 ,
Jan 31, 2024 Jan 31, 2024

Copy link to clipboard

Copied

    _checkAnnotationBoundingBox (annotation) {
        console.log("Checking Annotation Bounding Box");
        console.log(annotation);
        //copy annotation
        let annotationCopy = JSON.parse(JSON.stringify(annotation));
        if (annotation.motivation === "commenting") {
            const target = annotation.target;
            const selector = target.selector;
            if (selector.subtype === "note") {
                const boundingBox = selector.boundingBox;
                const x1 = boundingBox[0];
                const y1 = boundingBox[1];
                const x2 = boundingBox[2];
                const y2 = boundingBox[3];
                const width = x2 - x1;
                const height = y2 - y1;
                let annotationChanged  = false;
                if (width !== DEFAULT_COMMENT_SIZE) {
                    annotationChanged = true;
                    annotationCopy.target.selector.boundingBox[2] = x1 + DEFAULT_COMMENT_SIZE;
                }
                if (height !== DEFAULT_COMMENT_SIZE) {
                    annotationCopy.target.selector.boundingBox[3] = y1 + DEFAULT_COMMENT_SIZE;
                    annotationChanged = true;
                }
                if (annotationChanged) {
                    console.log("Updating Annotation Bounding Box");
                    console.log(annotationCopy);
                    this.adobeViewer.getAnnotationManager().then(annotationManager => {
                        annotationManager.updateAnnotation(annotationCopy).catch((error) => {
                            console.error("Failed to Update Annotation");
                            console.error(error);
                        });
                    });
                }
            }
        }
        return annotation;
    }

The client I am working for wanted all the Note bubbles to be uniforms sizes when downloaded and read in another pdf viewer. (Sometimes Note Annotations have rectangular instead of square bounding boxes for some reason) So I tried to run this code so that one annotation_added event it would check the size and update, but it throws an error saying there are no updatable fields. I can grab the exact error message later today if needed. 

Side note: I have some syncing logic for updates on different clients and when a note is moved on one client it doesnot move on the other clients which I believe is related.

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 Expert ,
Jan 31, 2024 Jan 31, 2024

Copy link to clipboard

Copied

Ok - This is going to sound odd try updating the text as well. Just add a space to the end or something. Originally, you could only update the text. 

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 ,
Jan 31, 2024 Jan 31, 2024

Copy link to clipboard

Copied

Thanks, I'll try that and let you know if that works when I have time to test it.

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 ,
Feb 02, 2024 Feb 02, 2024

Copy link to clipboard

Copied

LATEST

Appending a space to the bodyValue fixed the issue I had. It appears bounding boxes can only be updated if the text is modified. Note movement is now syncing correctly and the bounding box check is working correctly. Thanks for the help @Joel_Geraci !

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