10 Replies Latest reply on Dec 17, 2011 11:12 AM by [Jongware]

    Help with pagination

    KJDglasgow Level 1

      I am doing a project in Indesign where the pagination's last number is either raised or lowered depending on which side (right page sidenumber raised and left page sidenumber raised). However I am not sure how to do this the proper way and that it can easily be applied to all pages in the project without too much hassle. Can someone please enlighten me with the best way to do this? Help is highly appreciated.

        • 1. Re: Help with pagination
          [Jongware] Most Valuable Participant

          Do you mean the very last digit in a page number should be moved? (If so, that's going to be a problem.)

          • 2. Re: Help with pagination
            Peter Spier Most Valuable Participant (Moderator)

            Your description is a little vague. Can you show us a screen shot of a mockup for what you want?

             

            If it's as simple as the number position should be different for left and right pages, you need to make a master page and position current page markers in text frames at the appropriate locations. If it's just the last page that needs to be differnt, create a second master page that you can apply to last pages.

            • 3. Re: Help with pagination
              [Jongware] Most Valuable Participant

              Peter Spier wrote:

               

              .. If it's just the last page that needs to be differnt, create a second master page that you can apply to last pages.

               

              That's what I thought, but in general all my documents have only one single last page.

              • 4. Re: Help with pagination
                Peter Spier Most Valuable Participant (Moderator)

                [Jongware] wrote:

                 

                Peter Spier wrote:

                 

                .. If it's just the last page that needs to be differnt, create a second master page that you can apply to last pages.

                 

                That's what I thought, but in general all my documents have only one single last page.

                But you can base it on a two-sided master spread, and it will swap sides accordingly, or if you are clever enough that all docs end on a right hand page you can use a single page master.

                 

                or were you giving me trouble for saying last pageS? I was thinking in terms of chapters, of which there might be more than one.

                • 5. Re: Help with pagination
                  [Jongware] Most Valuable Participant

                  Peter Spier wrote:


                  or were you giving me trouble for saying last pageS?

                   

                  Ah, surely not. KJDglasgow's question is a bit too ambiguous, we need to know more before making a definite recommendation.

                   

                  (If this is about moving single digits, it'll need a script to make page numbers "live". Fortunately I know how to do that.)

                  • 6. Re: Help with pagination
                    Peter Spier Most Valuable Participant (Moderator)

                    [Jongware] wrote:

                     

                    Peter Spier wrote:


                    or were you giving me trouble for saying last pageS?

                     

                    Ah, surely not. KJDglasgow's question is a bit too ambiguous, we need to know more before making a definite recommendation.

                     

                    (If this is about moving single digits, it'll need a script to make page numbers "live". Fortunately I know how to do that.)

                    OK, good. I didn't want to have to break out the "alternate ending version" explanation.

                     

                    We definitiely need some clarification on what is intended...

                    • 7. Re: Help with pagination
                      KJDglasgow Level 1

                      Thats exactly what I mean Jongware, the last digit in the pagenumbers are to be altered. And it's not just the last pages but all pages in the work= the last digit to be either lowered or raised depending on which side right=raised digit, left=lowered digit). Please someone help me, can you try to explain as throughougly as you can as I am just new to this. Help appreciated!

                      • 8. Re: Help with pagination
                        [Jongware] Most Valuable Participant

                        Yeah this requires a script, since it's not possible to change the format of just a single digit. The script needs to copy the page number as live text on each separate page, and then you can format it at will. (With the obvious downside that the numbers won't update automatically if you insert, move, or delete pages.)

                         

                        It'll take just a slight re-write of this weeks' Page numbering with words but for today I'm otherwise engaged, so Volunteers May Step Forward. Or you'll have to wait until (probably) after the weekend.

                        • 9. Re: Help with pagination
                          [Jongware] Most Valuable Participant

                          Here is a Javascript to convert page numbers into text. The page number code should be on one of your master pages (which is Good Practice). The script copies the entire text frame onto each page and then replaces the page number code itself with the appropriate number. Then you can adjust your paragraph style for the left and right pages to make the first character move up and/or down -- I think adding a GREP style or a nested style may all be that's needed. Look in the Help for how to apply one of these.

                           

                          It goes without saying (but I'll do so anyway!) that this script will make the automatic page numbering loose its magic properties: every time you change the initial page number, or insert/move/delete pages, the page numbers will be out of sync. The same happens when you change the master page frame, or adjust the frmatting of this frame. No worries, all you have to do is run the script again.

                           

                          Standard advice for any script that does a lot of things on an entire document: May Include Bugs. Save A Copy Before Running.

                           

                          (hold on... it's not working!)

                          • 10. Re: Help with pagination
                            [Jongware] Most Valuable Participant

                            ... I suddenly noticed the script worked, but it didn't really replace the page number! Oh the oddities of InDesign. This one works fer sure, look:

                             

                            Screen Shot 2011-12-17 at 8.11.39 PM.png

                             

                            //DESCRIPTION:Convert Page Number into Text
                            // A Jongware Script 17-Dec-2011
                            
                            
                            var allPages = app.activeDocument.pages;
                            for (iterate=0; iterate<allPages.length; iterate++)
                            {
                                      customPageNumber (allPages[iterate]);
                            }
                            
                            function customPageNumber (aPage)
                            {
                                      if (aPage.appliedMaster == null)
                                                return;
                            
                                      pageSide = (aPage.side == PageSideOptions.RIGHT_HAND) ? 1 : 0;
                                      masterFrame = findFrameContaining (aPage.appliedMaster, pageSide, '\x18');
                                      if (masterFrame != null)
                                      {
                                                frame = findByLabel (aPage.pageItems, "page number");
                                                if (frame != null)
                                                {
                                                          frame.removeOverride();
                                                }
                                                frame = masterFrame.override (aPage);
                                                frame.label = "page number";
                            
                            
                                                placeholder = frame.contents.indexOf ('\x18');
                                                if (placeholder != -1)
                                                {
                                                           for (i=0; i<frame.characters.length; i++)
                                                           {
                                                                     if (frame.characters[i].contents == SpecialCharacters.AUTO_PAGE_NUMBER)
                                                                     {
                                                                              frame.characters[i].contents = aPage.name;
                                                                              break;
                                                                    }
                                                          }
                                                }
                                      }
                            }
                            
                            function findFrameContaining (master, side, text)
                            {
                                      var masterPage;
                                      var i;
                            
                                      if (master.pages.length > 1)
                                                masterPage = master.pages[side];
                                      else
                                                masterPage = master.pages[0];
                                      for (i=0; i<masterPage.textFrames.length; i++)
                                      {
                                                if (masterPage.textFrames[i].contents.indexOf(text) > -1)
                                                          return masterPage.textFrames[i];
                                      }
                                      // Not found? Perhaps on this Master's Master?
                                      if (master.appliedMaster != null)
                                                return findFrameContaining (master.appliedMaster, side, text);
                                      return null;
                            }
                            
                            // Needed because the very useful label lookup was
                            // -- totally unnecessarily! -- removed in CS5+ ...
                            function findByLabel (items, label)
                            {
                                      var i;
                                      for (i=0; i<items.length; i++)
                                                if (items[i].label == label)
                                                          return items[i];
                                      return null;
                            }