How to control the Edit and Delete Event of Annotation of PDF Embed API.

Community Beginner ,
Dec 09, 2020 Dec 09, 2020

Copy link to clipboard

Copied

Hi, I am using PDF Embed API for the web application wanted to get control of the Delete Action of the Annotation.
Why I would need this is listed below:


Imagine I am logged in as a User called "Amit" and added some annotation, this annotated value is stored in my local collection and logged out of the application.
The user called "Akash" logged in and see that the annotation is added to the PDF and he try to delete the annotation what "Amit" has added using the Delete Option in the  Drop Down.

I wanted to have control over the Delete Action before the Annotation is actually deleted.
I am listening to the Event Listener as 

adobeDCView.registerCallback(
        AdobeDC.View.Enum.CallbackType.EVENT_LISTENER,
        function(event) {
            console.log(event.typeevent.data)
            if(event.type === "ANNOTATION_DELETED"){
                if(event.data.creator.id != loggedInUserInfo.users._id){
                    $.alertable.alert("Can not delete "event.data.creator.name +"'s comment.");
                    return false;
                }
                else{
                    annotationUpdated(event);
                }
            } 
        }, eventOptions
    );
 
Not that I am not storing the Annotated Value in the PDF Buffer, rather storing it locally.
The Above logic work fine as it is not calling annotationUpdated() and when I do the reload it is actually getting it back. But this does not sound user friendly for me.

Please let me know how can I handle the EDIT and DELETE Option from the UI. 
Or for the alternate do let me know How to hide those options from UI.

Thanks.

Views

128

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
Adobe Community Professional ,
Dec 10, 2020 Dec 10, 2020

Copy link to clipboard

Copied

I have an example at this CodePen that shows how to immediately deselect an annotation that was selected by someone other than the author. If it can't be selected, it can't be deleted.

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 Beginner ,
Dec 11, 2020 Dec 11, 2020

Copy link to clipboard

Copied

Hi Joel, 
Thanks for the reply.

The above-mentioned example will not allow me to complete my workflow ie, to reply to the comment.
When a user comments, the other user will also reply to the comment added by the previous user.

 

That's why I would need control on how to handle the EDIT and DELETE Options from UI.

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
Adobe Community Professional ,
Dec 11, 2020 Dec 11, 2020

Copy link to clipboard

Copied

In that case. My suggestion would be to listen for "ANNOTATION_SELECTED" and if the author isn't the user, pop up a dialog where they can capture the reply text (or cancel) and then programmatically add the reply.

 

I've already submitted a feature request to "lock" annotations from other users but haven't heard an update on the request.

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 Beginner ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

Thanks Joel,
So Adobe does not give any control on the EDIT and DELETE Option is it ?

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
Adobe Community Professional ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

LATEST

Unfortunately, at this time, the commenting API and even the comment schema do not natively allow for annotation locking or limit a set of annotations from being modified. Currently, all actions are available for all annotations regardless of author. The best you can do at this time is to detect any changes and take the appropriate action.

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