Quantcast
Channel: Adobe Community : Unanswered Discussions - Acrobat
Viewing all articles
Browse latest Browse all 73766

Copy button on every page w/ Javascript

$
0
0

Hi, im creating a presentantion PDF with a few buttons that i want to repeat on every page.

 

Im already setting their function using javascript, see:

 

----------------------

 

var bt1 = this.getField("sair.Page 1");

bt1.setAction("MouseUp", "app.fs.isFullScreen = false;");

bt1.delay = false;

 

var bt2 = this.getField("tela.Page 1");

bt2.setAction("MouseUp", "app.fs.isFullScreen = true;");

bt2.delay = false;

 

var bt3 = this.getField("indice.Page 1");

bt3.setAction("MouseUp", "this.pageNum = 1;");

bt3.delay = false;

 

app.fs.clickAdvances = false;

 

----------------------

 

What i want to do is to copy this 3 buttons to every other page on the document using Javascript, instead of doing it manually.

 

I found the code below on JavaScript™ for Acrobat® API Reference, but i could not figure out how to apply this to my case.

Since the buttons are not created via script, only their functions.

 

----------------------

 

Copy a given annotation to every page in the document.

 

var annot = this.addAnnot({

page: 0,

type: "Text",

rect: [40, 40, 140, 140]

});

// Make a copy of the properties of annot

var copy_props = annot.getProps();

// Now create a new annot with the same properties on every page

var numpages = this.numPages;

for (var i=0; i < numpages; i++) {

var copy_annot = this.addAnnot(copy_props);

// but move it to page i

copy_annot.page=i;

 

----------------------

 

 

 

Thanks in advance


Viewing all articles
Browse latest Browse all 73766

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>