Skip to main content
Lively_Luminary16B7
Participant
October 17, 2017
Question

Page numbers in illustrator

  • October 17, 2017
  • 1 reply
  • 13699 views

Hi,

I have the script for inserting page numbers in Illustrator, but the problem

I face is there are 2 files of about 50 pages each. The first file I can insert

the page numbers from 1-50, but the second file, am not able to insert

from 51 onwards, need help on this please. thanks

felix

This topic has been closed for replies.

1 reply

Silly-V
Legend
October 17, 2017

Would this help you?

#target illustrator

function test(){

  var doc = app.activeDocument;

  var startNum = prompt("Specify the starting index", "1");

  if(startNum == null || !startNum){

    return;

  }

  startNum *= 1;

  if(isNaN(startNum)){

    alert("Not a valid number");

    return;

  }

  var newText, thisRect;

  var pageNumLayer = doc.layers.add();

  pageNumLayer.name = "Page Numbers";

  var counter = startNum;

  for(var i = 0;  i < doc.artboards.length;  i++){

    newText = pageNumLayer.textFrames.add();

    newText.contents = counter++;

    thisRect = doc.artboards.artboardRect;

    newText.position = [thisRect[2] - 20, thisRect[3] + 20];

  };

};

test();

Lively_Luminary16B7
Participant
October 18, 2017

Thanks for the qick response. but how do I save the above script as Java Script.

please help. thanks in advance

Lively_Luminary16B7
Participant
October 18, 2017

Hello,

Thanks, it works, but could you please add the coding to the image below. otherwise it works. Because we need to specify the margin as show. Much appreciate and thanks a lot