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

PDF.js Express Version

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


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:


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.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;

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.