Skip to main content
Participant
January 24, 2020
Answered

Replicating multiple stamps across all pages

  • January 24, 2020
  • 1 reply
  • 1442 views

Hi guys,

 

Hoping you can help.

 

For a while now i have been using some javascript to replicate stamps across all pages 

this.syncAnnotScan();

var annt = this.getAnnots(this.pageNum)[0];

var props = annt.getProps();

 

for(var i=0;i < this.numPages;i++){

props.page = i;

if(i != this.pageNum)

this.addAnnot(props);

}

However now i have the issue of having 2 stamps i need to replicate and this code will only replicate the first stamp i place does anyone know what i need to insert to get this to replicate both stamp? 

Correct answer try67

That's not enough to create a reliable script. I would suggest you use this code, but then it means you have to first select the stamp(s) (or any other comments for that matter) before running it:

 

this.syncAnnotScan();
var annots = this.selectedAnnots;
if (annots!=null) {
	for (var i in annots) {
		var annt = annots[i];
		var props = annt.getProps();
		for (var p=0; p<this.numPages; p++) {
			if (p==annt.page) continue;
			props.page = p;
			this.addAnnot(props);
		}
	}
}

 

1 reply

try67
Community Expert
Community Expert
January 24, 2020

Are those stamps the only comments in the file when you run the script?

cizwizAuthor
Participant
January 24, 2020

95% of the time yes

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
January 24, 2020

That's not enough to create a reliable script. I would suggest you use this code, but then it means you have to first select the stamp(s) (or any other comments for that matter) before running it:

 

this.syncAnnotScan();
var annots = this.selectedAnnots;
if (annots!=null) {
	for (var i in annots) {
		var annt = annots[i];
		var props = annt.getProps();
		for (var p=0; p<this.numPages; p++) {
			if (p==annt.page) continue;
			props.page = p;
			this.addAnnot(props);
		}
	}
}