Is it possible to pass mouse location manually for pasteCopiedAnnotations() method?

PDF.js Express Version
7.3.1

Detailed description of issue
I want to pass mouse location manually for pasteCopiedAnnotations( [useMouseLocation]); method. Actually I want to paste annotations at a certain position where I have x and y coordinates.

Is there any way to do this instead of passing a boolean, we can set a mouse location and then it will paste there. Annotations are Area/Linear.

Expected behaviour
Manually set mouse location for pasting annotation.

Code snippet

instance.annotManager.pasteCopiedAnnotations([true]);

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:

Guides:APIs:Forums:

Hi Kiran,

You can override hotkeys by using this API. By overriding ctrl+c and ctr+v you can control the behaviour of how you want to paste, by for example in this snippet changing the location of the annotation.

  const { annotManager } = instance;
  let copiedAnnots;
  instance.hotkeys.off(instance.hotkeys.Keys.CTRL_C);
  instance.hotkeys.off(instance.hotkeys.Keys.CTRL_V);
  instance.hotkeys.off(instance.hotkeys.Keys.COMMAND_C);
  instance.hotkeys.off(instance.hotkeys.Keys.COMMAND_V);
  instance.hotkeys.on('ctrl+c', e => {
      copiedAnnots = annotManager.getSelectedAnnotations();
    },
  );
  instance.hotkeys.on('ctrl+v',  e => {
      copiedAnnots.forEach((annot) => {
        const copiedAnnot = annotManager.getAnnotationCopy(annot);
        // adjust paste location here
        copiedAnnot.X = 50;
        copiedAnnot.Y = 50;
        annotManager.addAnnotation(copiedAnnot);
        annotManager.redrawAnnotation(copiedAnnot);
      })
    },
  );

Do note this currently only overriding window ctrl+c & ctrl+v as a proof of concept. I would recommend for a production environment to also override command+c and command+v for Apple devices.

Cheers,
Dustin