Skip to main content
Known Participant
Jan 20, 2021 8:50 AM UTC
Question

copy from window javascript box..

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 is closed to new replies. Start a new post to keep the conversation going.

2 replies

Legend
Jan 20, 2021 10:31 AM UTC

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

Translate
try67
Community Expert
Community Expert
Jan 20, 2021 9:16 AM UTC

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

Translate