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

Replicating multiple stamps across all pages

Community Beginner ,
Jan 24, 2020 Jan 24, 2020

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
1.4K
Translate
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);
		}
	}
}

 

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

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

Translate
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

95% of the time yes

Translate
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

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

 

Translate
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
LATEST

Absolute Legend exactly what i needed thank you!!

Translate
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