I am using pdf js express to draw highlight annotation in pdf. But when I couldn’t delete the annotation from the pdf. I am using this code to create highlight:
const { Annotations, annotManager } = instance;
citations.forEach((citation) => {
if (citation.quads && isNumber(citation.page) && !isNaN(parseInt(citation.id))) {
const citationAuthor = citation.created_by && citation.created_by.user
? `${citation.created_by.user.first_name} ${citation.created_by.user.last_name}`.trim()
: author;
const highlight = new Annotations.TextHighlightAnnotation();
highlight.Author = citationAuthor;
highlight.Quads = citation.quads;
highlight.PageNumber = citation.page;
highlight.Id = citation.id.toString();
highlight.Locked = true;
highlight.Subject = 'Citation';
annotManager.addAnnotation(highlight, true);
annotManager.drawAnnotations(highlight.PageNumber);
}
});
I am not finding any way to delete highlight annotation which will basically remove the highlight from the pdf. I tried deleteAnnotation but it is not deleting the highlight from the pdf.