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.
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.
I.e.
const { documentViewer } = instance.Core;
documentViewer.addEventListener('annotationsLoaded', () => {
// you can delete annotations here
// then you can import your custom xfdf annotations
})