Skip to main content
Inspiring
June 2, 2015
Question

Auto page numbering

  • June 2, 2015
  • 1 reply
  • 1361 views

I having more than hundred application files. I need to reset the page number for all application file based on sequence.

Example first chapter staring page no 1 and end page no 10

I need to change the second chapter starting number 11

Is this possible to update the page number via scripting

This topic has been closed for replies.

1 reply

Inspiring
June 2, 2015

In reference to your question about auto page numbering:

Yes, you can change page numbering using scripting. You can also change the auto page numbering manually from the pages panel: From the list of pages in the document, select the page at which you want to change numbering. Then, from the pages panel's contextual menu (little down arrow at top right) select numbering and section options. This dialog is pretty self explanatory. Check Start Section, and Start Page Numbering at. Enter the number for the page.

If you combine your documents into a book (File > New > Book), you can update the page numbering from the Book's contextual menu. Select Update Numbering, then Update Page and Section Numbers.

With scripting the process is similar: you can create sections and indicate where the section will start, what the page number will start with, and so on. The following is for AppleScript, ExtendScript will be similar.

tell application "Adobe InDesign CC 2014"

   set docRef to document 1

   tell docRef

      set pageRef to page 1 of spread 1

      set sectionCount to count of sections

      if sectionCount > 0 then

         tell section 1

            set continue numbering to false

           set page start to pageRef

           set page number start to 1

        end tell

      else --if no sections exist

         make section with properties {name:"First", page number style:arabic, continue numbering:false, page number start:1, page start:pageRef, marker:"", length:8, section prefix:"", include section prefix:false}

      end if

   end tell

end tell

Hope this is what you needed.

Inspiring
June 3, 2015

I am having windows machine. Is this possible via java scripting.

Inspiring
June 7, 2015

Sorry for delay in reply. Yes, you can definitely do this with ExtendScript. In this example, a second section is created in the same document. Try this with a document having 8 pages.

var docRef = app.activeDocument; 

var pageRef = docRef.spreads.item(0).pages.item(0);

var sectionCount = docRef.sections.count();

var sectionProps = {pageNumberStyle:"arabic", continueNumbering:false, pageNumberStart:1, marker:"", sectionPrefix:"", includeSectionPrefix:false}

if (sectionCount > 0) {

    var section1 = docRef.sections.item(0);

     section1.continueNumbering = false;

     section1.pageStart = pageRef;

     section1.pageNumberStart = 1;

} else {

    section1 = docRef.sections.add(pageRef);

    section1.name = "Section1";

    section1.properties = sectionProps;

}

if (docRef.sections.count() == 1) {

   sectPageRef = docRef.spreads.item(5).pages.item(0);

   var section2 = docRef.sections.add(sectPageRef);

   section2.name = "Section2";

   section2.properties = sectionProps;

}