Skip to main content
Known Participant
June 14, 2023
Answered

page number sequence

  • June 14, 2023
  • 1 reply
  • 1041 views

Hi,

I have a document of 1000 pages. I would like to add text numbers from 1 to 10 on each page, then repet again and again..1/10,1/10 ..until the end

can be done this with acrobat javascript or another method? Thank you very much!

page 1:  1 /10

page 2:  2 /10

page 3:  3 /10

page 4:  4 /10

..

page 10: 10/10

page 11: 1/10

page 12: 2/10

page 13: 3/10

page 14: 4/10

...

 
 
 
 
This topic has been closed for replies.
Correct answer try67

You can do it by executing this code, from the JS Console, a Custom Command or an Action:

 

for (var p=0; p<this.numPages; p++) {
	var idx = (p%10)+1;
	var pageHeight = this.getPageBox("Crop", p)[1];
	var offset = 28.3465;
	var r = [offset, pageHeight-offset, offset+50, pageHeight-(offset+50)];
	var f = this.addField("PageLabel"+idx, "text", p, r);
	f.textFont = "Arial";
	f.textSize = 12;
	f.textColor = color.black;
	f.fillColor = color.white;
	f.strokeColor = color.white;
	f.lineWidth = 0;
	f.readonly = true;
	f.defaultValue = idx + "/10";
	f.value = f.defaultValue;
}
//this.flattenPages(); 

 

Uncomment the last line if you want to flatten all the fields at the end of the process. Note this will also affect any other fields, links and comments in the file!

1 reply

try67
Community Expert
Community Expert
June 14, 2023

Yes, it can be done using a script. Where do you want the text to appear, exactly, and what should it look like (font, color, size, etc.)?

 

Known Participant
June 14, 2023

thanks for the reply

text: 1 / 10

position: left 10 mm, top 10 mm 

font : arial 12 pt

color: 100 % gray or k (black)

 

 
 
 
 
 
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
June 14, 2023

You can do it by executing this code, from the JS Console, a Custom Command or an Action:

 

for (var p=0; p<this.numPages; p++) {
	var idx = (p%10)+1;
	var pageHeight = this.getPageBox("Crop", p)[1];
	var offset = 28.3465;
	var r = [offset, pageHeight-offset, offset+50, pageHeight-(offset+50)];
	var f = this.addField("PageLabel"+idx, "text", p, r);
	f.textFont = "Arial";
	f.textSize = 12;
	f.textColor = color.black;
	f.fillColor = color.white;
	f.strokeColor = color.white;
	f.lineWidth = 0;
	f.readonly = true;
	f.defaultValue = idx + "/10";
	f.value = f.defaultValue;
}
//this.flattenPages(); 

 

Uncomment the last line if you want to flatten all the fields at the end of the process. Note this will also affect any other fields, links and comments in the file!