0

How to create a text frame with a progressive numbering that automatically increases in all the artboards? (as an automatic numbering of pages)

For example:
artboard 1 => number 100
artboard 2 => number 101
artboard 3 => number 102
etc

example of the project

I've already done it manually for another project, as shown in the screenshot, but I'd like to avoid the manually solution for this project. So I was trying to find another solution, not a manual one, keeping using Illustrator.

  • 1
    Illustrator has no automatic page numbering feature, although you may be able to script it, or there may be existing scripts out there. I think it would be better to use InDesign for creating a multi-page document since it's actually designed for page layout, and Illustrator isn't. InDesign has automatic page numbering. – Billy Kerr Sep 8 '18 at 10:36
  • Thanks @BillyKerr for this project I have to use Illustrator, so I'm trying to look for the scripts but I haven't find them yet. Do you have any other advice for Illustrator with or without using the scripts? – benny-ben Sep 8 '18 at 10:45
  • Without a script, you'd probably need to do it manually I think. – Billy Kerr Sep 8 '18 at 10:46
1

I tested this script and does the job:

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[i].artboardRect;

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

};

};

test();

pages

Source: https://forums.adobe.com/thread/2395987

  • 2
    I tried the script and it works, but to set it up you need to know JavaScript first and above all the properties and methods used by Illustrator. The learning curve is quite high. I've followed these documents pdf - web, but I haven't yet managed to modify the script as I wanted. Anyway, this is a step forward in the world of script for Ai. Thank you! – benny-ben Sep 10 '18 at 15:34
  • I also proposed a semi-automatic solution without the use of scripts :) – benny-ben Sep 10 '18 at 15:36
1

I found this method fast enough without using scripts


Create a new Document with multiple Artboards

File > New... -> More Settings -> Number of Artboards

enter image description here


Create a Area type in all Artboards

Type tool : drag diagonally to define a rectangular bounding area within the Artboards

Control panel : set the Font, Font Style and Size (The height of the character must be slightly smaller than the height of the Area type) options.

Selection tool : select the Area type object you just created

Edit > Cut

Edit > Paste on All Artboards

Link all the Area type objects

Selection tool : select all Area type objects

Type > Threaded Text > Create

With a spreadsheet program (Calc/Excel) create the numbering sequence

Enter the first number in a cell, then click on that cell, so it has the black outline. Click on the little black square in the lower right corner of the outline, hold and drag down to the desired number.

enter image description here

Select all numbered cells and copy them.


Enter the numbering in Illustrator

Selection tool : double click on the Area type object in the first Artboards

Edit > Paste

For graphics, use a Symbol Instance inserted in all the Artboards in a layer below the Area type objects.






Instead I started to modify the script this way:

function bennytest(){

  var doc = app.activeDocument;

  function isNaNchecker(check) {
    if(check == null || !check){
      return;
    }

    // determines whether a value is an illegal number
    if(isNaN(check)){
      alert("Not a valid number");
      return;
    }
  }

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

  isNaNchecker(startNum);
  //alert(startNum + " - " + (typeof startNum));

  var marginBottomNum = prompt("Specify the bottom margin in pt", "0");
  marginBottomNum *= 1;

  isNaNchecker(marginBottomNum);
  // alert(marginBottomNum + " - " + (typeof marginBottomNum));

  var sizeNum = prompt("Specify the character dimension in pt", "20");
  sizeNum *= 1;

  isNaNchecker(sizeNum);
  // alert(sizeNum + " - " + (typeof sizeNum));

  var newText, thisRect;

  var pageNumLayer = doc.layers.add();

  pageNumLayer.name = "Auto-Numbers";

  var counter = startNum;

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

    newText = pageNumLayer.textFrames.add();

    newText.contents = counter++;

    thisRect = doc.artboards[i].artboardRect;

    newText.position = [(thisRect[0] + thisRect[2]) / 2, thisRect[3] + marginBottomNum];
    // alert("0 (x0): " + thisRect[0] + "\n1 (y0): " + thisRect[1] + "\n2 (x1): " + thisRect[2] + "\n3 (y1): " + thisRect[3] + "\n\nw: " + newText.width + "\nh: " + newText.height);

    newText.textRange.characterAttributes.size = sizeNum;

    newText.textRange.justification = Justification.CENTER;

    // newText.textRange.characterAttributes.textFont = app.textFonts[7];      // who knows?
    // newText.textRange.characterAttributes.textFont.name = "Arial";          // doesn't work

  };

};

bennytest();
  • Well for non-coders & non-scripters, your workaround outlined above works like a champ! – GerardFalla Sep 10 '18 at 15:58
  • @GerardFalla glad to read your comment, thank you :) – benny-ben Sep 10 '18 at 16:12
0

Just making it manually.

Once created an artboard with the text frame and duplicating it, you can create text threads like in Indesign and type the numbers:

text

  • Thanks @Danielillo but I'd like to avoid the manually solution for this project because there are a lot artboards – benny-ben Sep 8 '18 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.