Don't load annotations on document load

Which product are you using?
PDF.js Express

PDF.js Express Version

Detailed description of issue
I try to load document to viewer and next import (and show) only my custom xfdf annotations, but when the pdf already has annotation they are loaded first.

Expected behaviour
Annotations already contained in the file are not loaded, or they are deleted immadiantely after document loaded.

Manual removing all annotation after documentloaded event not works because annotations are showed later. Moreover annotationsLoaded event is never fired.

Hi there,

Thank you for reaching out to pdf.js express,

Please check this guide out for the lifecycle of the viewer:

documentLoaded event will always trigger first before the annotationLoaded event. This means you have to wait for the annotationLoaded event to trigger before you can delete the annotations in the document.

const { documentViewer } = instance.Core;
documentViewer.addEventListener('annotationsLoaded', () => {
  // you can delete annotations here 
  // then you can import your custom xfdf annotations 

Best regards,
Kevin Kim