Skip to main content
Known Participant
January 20, 2021
Question

copy from window javascript box..

  • January 20, 2021
  • 2 replies
  • 553 views

Hello everybody,

 

I have a small javascript custom tool button that shows me the trim size of the pdf page.
Is this possible to copy the mesage alert (or if there is another type of window box) on clipboard after the window appears ?

Thank you.

 

function TrimSize(){

var aRect = this.getPageBox("Trim");
var width = aRect[2] - aRect[0];
var height = aRect[1] - aRect[3];

var rw =(width*0.3528).toFixed(1);
var rh = (height*0.3528).toFixed(1);
//___________________________________________


app.alert("Trim: " + rw + " mm x "+ rh + " mm"
);
}

app.addToolButton({
    cName: "Trim Size",
    cLabel: "Trim Size",
    cExec: "TrimSize()",
	cTooltext: "Trim Size",
    nPos: 0
	
});

 

This topic has been closed for replies.

2 replies

Legend
January 20, 2021

The clipboard is outside JavaScript's sandbox (because it can affect other apps).

try67
Community Expert
Community Expert
January 20, 2021

No. JS in Acrobat can't copy text to the clipboard, or paste from it.