Replicating multiple stamps across all pages

Community Beginner ,
Jan 24, 2020

Copy link to clipboard

Copied

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? 

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

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);
		}
	}
}

 

TOPICS
Acrobat SDK and JavaScript, How to

Views

143

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Replicating multiple stamps across all pages

Community Beginner ,
Jan 24, 2020

Copy link to clipboard

Copied

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? 

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

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);
		}
	}
}

 

TOPICS
Acrobat SDK and JavaScript, How to

Views

144

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jan 24, 2020 0
Most Valuable Participant ,
Jan 24, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 24, 2020 0
Community Beginner ,
Jan 24, 2020

Copy link to clipboard

Copied

95% of the time yes

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 24, 2020 0
Most Valuable Participant ,
Jan 24, 2020

Copy link to clipboard

Copied

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);
		}
	}
}

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 24, 2020 2
cizwiz LATEST
Community Beginner ,
Jan 24, 2020

Copy link to clipboard

Copied

Absolute Legend exactly what i needed thank you!!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 24, 2020 0