Which product are you using?
PDF.js Express Viewer
PDF.js Express Version
8.7.4
Detailed description of issue
Is it possible to disable the auto reply created by updating annotation state? Is it also possible to decouple the icon shown on the sticky note from the reply? It seems like setting the State property directly does not have an effect on the UI.
Expected behaviour
Here the icon is ‘Completed’ but only because of the reply. Otherwise the icon would be None even though the State isn’t.
Does your issue happen with every document, or just one?
All documents.
Hello dopefakedusername,
Would disabling the elements work for you?
That would make the state not changeable by the user.
For removing the auto-reply, theres no API, however a reply is essentially another annotation with its “in-reply-to” pointing to the ID of the parent. Therefore you could just delete that new annotation when its created.
Best regards,
Tyler
My issue is that the reply is coupled with the note status. If I delete the reply when its created, the note status defaults to ‘None’. I would like it to be possible to have whatever note status is required while also not having the reply.
Hello dopefakedusername,
Try:
annotationManager.updateAnnotationState(annotation, 'Completed');
// or
annotation.State = "Completed"
Best regards,
Tyler
I have tried this actually. Problem is that the status button wouldn’t reflect this manually set state. Which kinda defeats the purpose of having the status button.
Hello dopefakedusername,
You would need to trigger the annotationChanged event after adjusting the annotations properties
Something like:
annotationManager.trigger("annotationChanged", [annotation, "modify", {imported: false, isUndoRedo: false, source: "custom"}])
Best regards,
Tyler
This still isn’t a solution. I’m doing as follows:
const annot = new instance.Core.Annotations.StickyAnnotation({
Author: authorName,
PageNumber: pageNumber,
X: x,
Y: y,
DateCreated: commentCreatedAt,
Icon: ‘Comment’,
Opacity: opacity || 1,
Color: noteColor || new instance.Core.Annotations.Color(255, 205, 69, 1),
})
annot.StateModel = ‘Review’
annot.State = ‘Completed’
annotManager.trigger(“annotationChanged”, [[annot], “modify”, {imported: false, isUndoRedo: false, source: “custom”}])
annotManager.addAnnotation(annot)
annotManager.redrawAnnotation(annot)
But here you can see the comment is loaded with no state.
Hello dopefakedusername,
Did you try the other option:
annotationManager.updateAnnotationState(annotation, 'Completed');
Best regards,
Tyler
Yes, that is actually my current implementation. And that brings us back to my main issue with the status which is that it will auto generate a reply using that function call. In the image you can see that when I create the annotation and update it’s state to what the user set previously, it will create a reply. I was wondering if it was possible to do so without any replies.
const annot = new instance.Core.Annotations.StickyAnnotation({
Author: authorName,
PageNumber: pageNumber,
X: x,
Y: y,
DateCreated: commentCreatedAt,
Icon: ‘Comment’,
Opacity: opacity || 1,
Color: noteColor || new instance.Core.Annotations.Color(255, 205, 69, 1),
})
annotManager.addAnnotation(annot)
annot.DateModified = updatedAt
instance.Core.annotationManager.updateAnnotationState(annot, ‘Completed’);
annotManager.redrawAnnotation(annot)
Hello dopefakedusername,
Apologies for the confusion here. I checked the PDF spec and it looks like what you’re trying to accomplish goes against the spec.
It states:
The state is not specified in the annotation itself but in a separate text annotation that refers to the original annotation by means of its IRT (“in reply to”) entry (see Table 173). States shall be grouped into a number of state models, as shown in Table 171.
Meaning that the reply is actually necessary to define the annotations state.
Best regards,
Tyler