3 Replies Latest reply on Jun 6, 2011 9:55 AM by csm_phil

    How to start page numbering at page 2?

    xmlapi Level 1

      How do I start the page numbering at page 2 (but begin with the number 1)? Currently, I'm using a "no page numbers master" on page 1 and a "page numbers" master on the other pages. Page 2 starts the numbering at 2 instead of 1.

        • 1. Re: How to start page numbering at page 2?
          aanavaras Level 1


          Try this javascript.



          var myDoc = app.activeDocument;
          var mySec = myDoc.sections.add(myDoc.pages[1]);
          mySec.continueNumbering = false;
          mySec.pageStart = myDoc.pages[1];
          mySec.pageNumberStyle = PageNumberStyle.arabic;
          mySec.pageNumberStart = 1;
          mySec.includeSectionPrefix = false;



          Hope this helps...



          — SaRaVaNaN.N

          • 2. Re: How to start page numbering at page 2?
            xmlapi Level 1

            For some reason this doesn't work on Page 2. On page 3 or the other pages, it works fine.

             

            As soon as I specify the page start at Page 2, the page number footer disappears from page 2 (it's fine on the other pages). If I specify the start page at Page 3, then it works fine but Page 2 has the wrong number.

             

            Any idea what's causing the issue?

             

            //Page 2's page number footer disappears

                 Section section = courseTemplate.Sections.Add(courseTemplate.Pages[2]);
                                section.ContinueNumbering = false;
                                section.PageStart = courseTemplate.Pages[2];
                                section.PageNumberStart = 1;

             

             

             

            //Page 2's page number footer appears but is the wrong page number (page 2). From page 3, the page number starts at 1.

                 Section section = courseTemplate.Sections.Add(courseTemplate.Pages[3]);

                                section.ContinueNumberng = false;

                                section.PageStart = courseTemplate.Pages[3];

                                section.PageNumberStart = 1;

            • 3. Re: How to start page numbering at page 2?
              csm_phil Level 4

              Hi XMLapi,

               

              May be you expecting this, otherwise sorry for the objections.

               

              Can you please try this.

               

              var courseTemplate = app.activeDocument;

               

              var myPage = courseTemplate.sections.add(courseTemplate.pages[1]);
              with(myPage){
              continueNumbering= false;

              //pages[1] is assining the pages[2], you already know because javascript count starting from 0.
              pageStart = courseTemplate.pages[1];
              pageNumberStart = 3;
              }

               

              thx

              csm_phil