Custom "annotation review" behavior

WebViewer Version: 8.7.0

“No” to all of these questions:

  • Do you have an issue with a specific file(s)?
  • Can you reproduce using one of our samples or online demos?
  • Are you using the WebViewer server?
  • Does the issue only happen on certain browsers?
  • Is your issue related to a front-end framework?

Is your issue related to annotations? Yes

We have a use case in which we are programmatically generating text highlight annotations (i.e. similar to some of what is happening in this sample).

We would like to give users the ability to “navigate” through these generated annotations and approve/dismiss them in some way. “Approving” them would persist XML data to our database, analogous to how we handle user-triggered ANNOTATION_CHANGED events.

We are planning to build this functionality outside of WebViewer; however, I am curious if you have thoughts on whether or not this could be built within the WebViewer UI? Specifically, it would be interesting to leverage the “annotation note connector line” functionality that is exposed in the “Comments” sidebar:

Is any of this functionality composable in any way? Could we build out a custom sidebar within WebViewer?

If we were to build this outside of WebViewer, is there a way to programmatically navigate / select an annotation within the document viewer and/or programmatically select a comment (which has a line connecting to its annotation).

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:


Hello nick,

We have a couple APIs that could be useful for this functionality:

Combining these into a workflow like:

const highlightAnnot = new HighlightAnnotation();

// user clicks accept/reject/etc
annotationManager.updateAnnotationState(highlightAnnot, 'Completed');
// save annotation's state to the database (or using the annotation XFDF)

Does this work for you?

Best regards,
Tyler Gordon
Web Development Support Engineer

1 Like

Thanks, @tgordon! That was helpful.

We have something like this going:


However, sometimes, the inline “annotationPopup” toolbar does not become visible, i.e.

Screen Shot 2022-09-19 at 3.22.36 PM

Is there a way to ensure selectAnnotation consistency displays the “annotationPopup” toolbar?

My sense is this has something to do with jumpToAnnotation / page scrolling.

Hello nick,

Im unable to reproduce the annotation popup not appearing sometimes, however similar to the notesPanel you can manually open it with:


Best regards,
Tyler Gordon
Web Development Support Engineer

Thanks, we’ll look into adding that.

@tgordon, one more tangentially related question: When deleting an annotation (via annotationPopup), the deleted annotation still seems to be in-memory via (annotationManager.getAnnotationsList). Is this expected and/or is there a way to retrieve the set of non-deleted annotations?

Hi Nick,

Im unable to reproduce the issue of the deleted annotation still in memory. Here are the steps I used:
0. Go to: PDFTron WebViewer Demo: JavaScript PDF Viewer Demo

  1. Create annotation
  2. Do: instance.Core.annotationManager.getAnnotationsList()
  3. Open annotation popup
  4. Click delete button
  5. Do: instance.Core.annotationManager.getAnnotationsList()

Best regards,
Tyler Gordon
Web Development Support Engineer

I created another topic which we can use to further triage this issue.