Sometime function is not executing even after call with proper parameter

Question : Some times annotations wont deleted even if we called that
function. We have used "deleteAnnotation(selectedAnnot); " command to
delete Annotation
Same thing happens with loading existing annotations (xfdf strings)
in viewer. We have used “importAnnotCommand(xfdf)” method to load
Note: we have used debugger for our code, everything works fine till
these 2 commands call . Each annotation xfdf string is properly
getting into these 2 commands .

some more description :
Currently annotations won’t be saved inside pdf and it seems like there may be permission issues but it is not like that. Because we are saving XFDF strings separately inside our database. Whenever pdf loads into viewer annotations are imported separately using importAnnotCommand .Also we are not setting up any permission for any user .
Basically this is happening some times only , if we reload and again call delete function then annotations get deleted. I don’t know why this is happening but in both cases (before reload and after reload screen) function gets executed properly with proper parameters.

Hey there! Thanks for using PDF.js Express.

Can you confirm that when you reload the page, you are also reloading the same document?

PDF.js Express renders flattened annotations if they exist in the document that you open, and these might be the annotations you are seeing that cannot be deleted. We are going to be adding an option to disable this feature very soon.

Thank you!

Hi Logan,

  1. When i delete any annotation(s) from a page then i am not reloading that page at all . But sometimes annotations not get deleted.
  2. When i import annotation(s) then there are 2 cases:
    1. annotation(s) imported with reload of document i.e new document.
    2. annotation(s) imported without reloading the document.
      In both cases sometime viewer doesn’t load annotations even if i call function with proper parameter.
      Please note that , I have used “importAnnotCommand()” and “deleteAnnotation()” methods to import and delete annotations respectively.
      is there any other way to do import and delete annotations?

Thank you


When you try delete an annotation and it doesn’t actually delete, are you still able to select the annotation on the document by clicking on it?

The recommended way to import/export annotations is with the ‘importAnnotations’ and ‘exportAnnotations’ APIs. It’s not recommended to use ‘importAnnotCommand’.


yes i am able to click that annotation ,but when i reload page that annotation is deleted since we have called delete annotation API right after deleteAnnotation() method(our delete annotation API runs each and every time when i delete annotation).

Thank you for recommended methods. i’ll definitely try these methods .

Hi Logan,
Is it possible to change user name (‘Guest’) at runtime (without reload) ? i.e.
after i draw any annotation can i set/change user name for that drawn annotation?
Could you please share information regarding this and how can i achieve this thing (if possible).