• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Disable Auto-select when ussing addAnnotation method

Community Beginner ,
Oct 25, 2023 Oct 25, 2023

Copy link to clipboard

Copied

Hi,
I want to be able to silently add annotations with out disturbing the user's workflow. Is there a way to not select an annotation when added using the addAnniotation method.

The update and delete methods work how I expect just not the add function.

 

Thanks

TOPICS
PDF Embed API

Views

227

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Beginner , Nov 01, 2023 Nov 01, 2023

For anyone who may come across this in the future, adding multiple annotations in one call of addAnnotations had the behaviour I was looking for.

Votes

Translate

Translate
Community Beginner , Nov 23, 2023 Nov 23, 2023

Hi,

 

I was wondering about the same thing, but the workaround with adding multiple annotations wasn't really an option for me, since it would pollute the undo history if I added a second annotation and instantly deleted it afterwards.

 

So I looked up the piece of code, that adds the annotations and it turns out, you can actually add a second argument to the addAnnotations method.

 

// silently adds a single annotation
annotationManager.addAnnotations([template], {silent: true});

 

Maybe someone should

...

Votes

Translate

Translate
Community Beginner ,
Nov 01, 2023 Nov 01, 2023

Copy link to clipboard

Copied

For anyone who may come across this in the future, adding multiple annotations in one call of addAnnotations had the behaviour I was looking for.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 23, 2023 Nov 23, 2023

Copy link to clipboard

Copied

Hi,

 

I was wondering about the same thing, but the workaround with adding multiple annotations wasn't really an option for me, since it would pollute the undo history if I added a second annotation and instantly deleted it afterwards.

 

So I looked up the piece of code, that adds the annotations and it turns out, you can actually add a second argument to the addAnnotations method.

 

// silently adds a single annotation
annotationManager.addAnnotations([template], {silent: true});

 

Maybe someone should mention this in the documentation? Or will this be removed in future releases?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 23, 2023 Nov 23, 2023

Copy link to clipboard

Copied

LATEST
Great find! I would love to hear if this will be deprecated also.

I’ve been working on my solution for a bit and found that if you add the
annotation you want to add and a “bad” annotation (like a reply to non
existent comment). It will add the real annotation correctly, throw an
error for the “bad”, and still silently add. I just added some logic to
ignore the error.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources