Issue using execPasteAction

Posted by: aheath on 7 February 2023, 12:49 am EST

  • Posted 7 February 2023, 12:49 am EST

    There seems to be a bug with execPasteAction and it doesn’t respect the pageIndex passed to it. We’re trying to place the pasted annotation at specific coordinates on a specific page. It seems like there’s a version of execPasteAction that allows x, y, and pageIndex parameters but pageIndex doesn’t seem to work and pasted items always appear on the first page. Could you provide an example of using execPasteAction in this way?

    Also, what’s the best way to convert page coordinates (from mouse position for example) to pdf coordinates? We have a method that calculates the position using the viewPort and pagebounds but I’m wondering if there’s a more straightforward way.


  • Posted 7 February 2023, 3:34 pm EST - Updated 7 February 2023, 3:39 pm EST


    We have tried the below code snippet, and it is working fine on our end. Please refer to the following code snippet and an attached gif of the observation and if the issue persists please share a working sample that replicates the issue so that we could investigate it further and help you accordingly.

    	shortcuts: {
    			"V": {
    				ctrl: true,
    				tool: function () {
    					viewer.execPasteAction({ x: 10, y: 10, pageIndex: 1 }).then(function (e) {
    						// flag variable for checking the paste operation

    For the second issue, we are unable to find any public API to achieve this hence, we have escalated this issue to the concerned team for further investigation. We will update you as soon as we get any information from the team. the internal ID for this issue will be DOC-5118



  • Posted 26 February 2023, 1:50 pm EST

    Hi Avanish, thanks for your help. The execPasteAction method seems to be working as expected.

    The only way to convert the browser coordinates to PDF coordinates accurately was to use the non-public globalPointToPagePoint() on the viewer instance. Is there a public alternative to this? I’d rather not rely on a undocumented API but for now it seems like the best solution.

  • Posted 27 February 2023, 3:19 am EST


    We are sorry for the inconvenience but please go with the private property for now. We will let you know as we have public property is there for this.


    Manish Gupta

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels