• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Replicating multiple stamps across all pages

Community Beginner ,
Jan 24, 2020 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? 

TOPICS
Acrobat SDK and JavaScript

Views

817

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
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 24, 2020 Jan 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);
		}
	}
}

 

Votes

Translate

Translate
Community Expert ,
Jan 24, 2020 Jan 24, 2020

Copy link to clipboard

Copied

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

Votes

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
community guidelines
Community Beginner ,
Jan 24, 2020 Jan 24, 2020

Copy link to clipboard

Copied

95% of the time yes

Votes

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
community guidelines
Community Expert ,
Jan 24, 2020 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);
		}
	}
}

 

Votes

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
community guidelines
Community Beginner ,
Jan 24, 2020 Jan 24, 2020

Copy link to clipboard

Copied

LATEST

Absolute Legend exactly what i needed thank you!!

Votes

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
community guidelines