12 Replies Latest reply on Mar 15, 2016 9:11 AM by philippeh92651011

    Inverse page numeration


      Hi! Im trying to put in a document in indesign the number of pages left of the document aswell as the number of page in which we are (i.e. in a document of 30 pages: 1 - 29, 2 - 28, 3 - 27....). Does anyone know how to do it without typing it manually?

        • 1. Re: Inverse page numeration
          Peter Spier Most Valuable Participant (Moderator)

          Once you have a final page count you can use a number list (text file) and place that in threaded frames (on your master page). Number lists are easy to generate in a spreadsheet like Excel.

          • 2. Re: Inverse page numeration
            Obi-wan Kenobi Level 5

            Hi Peter,


            A funny way totally done in InDesign in several minutes:


            Place the standard "Page Number" blocks [master page] on a "Green" layer.


            Capture d’écran 2015-08-10 à 20.30.21.png

            Create a variable "PageNum" based on the Page Number para style, insert it 2 times, apply "Red" and "Green" char styles and place the 2 blocks [master page] on a "Red" Layer.


            Capture d’écran 2015-08-10 à 20.38.01.png

            On the current pages, liberate only these 2 layers: Green and Red layers. What you see at this moment:

            Capture d’écran 2015-08-10 à 20.31.17.png

            Convert these variables "PageNum" to text, using tomaxxiVARIprocessor.jsx, written by Marijan Tompa [ ;-) ].


            Capture d’écran 2015-08-10 à 20.31.49.png


            And, finally, make maths with NumberAdjuster.jsx, written by Steve Wareham [ ;-) ] (Note we have 20 pages in the ID doc).

            … A very simple soustraction: x - 20

            Capture d’écran 2015-08-10 à 20.32.39.png


            Mask the "Green" layer and go to sleep!  Cool! 


            Capture d’écran 2015-08-10 à 20.33.01.png


            Before you tell me: "… If the layout moves and old pages disappear or new pages appear ! …"

            Don't forget to make a copy-backup of the 2 layers!  ;-)

            • 3. Re: Inverse page numeration
              rob day Adobe Community Professional & MVP

              Obi, since you are into a script, this simplifies. Haven't tested much, but if you add or subtract pages just run it again. It checks for master page items with an auto number, overrides it and adds the suffix. This is AppleScript, so OSX only:



              tell application "Adobe InDesign CC 2014"


                  set ms to every page item of every master spread of active document

                  --gets any master page item with an auto number

                  repeat with mpitem in ms


                          set clist to every character of parent story of mpitem

                          if auto page number is in clist then

                              set mp to parent of parent page of mpitem

                              --suffix handler (run twice in case pages were added?)

                              my PageNumbers(mp, object reference of mpitem)

                              my PageNumbers(mp, object reference of mpitem)

                          end if

                      end try

                  end repeat

              end tell


              --add the suffix (master page, auto number frame)

              on PageNumbers(mp, mpitem)

                  set cnt to 0

                  tell application "Adobe InDesign CC 2014"

                      tell active document

                          set pcnt to count of pages

                          set ps to every page whose applied master is mp

                          --page loop

                          repeat with p in ps

                              set cnt to cnt + 1

                              --reset overridden page numbers

                              repeat with a in all page items of p

                                  set pleft to (pcnt - cnt) as string

                                  set ompi to overridden master page item of a

                                  if overridden master page item of a is mpitem then

                                      remove override of a

                                  end if

                              end repeat

                              --override all the page numbers and add the suffix

                              repeat with x in master page items of p

                                  if object reference of x is equal to object reference of mpitem then

                                      set pn to override x destination page p

                                      set last insertion point of parent story of pn to "-" & pleft

                                  end if

                              end repeat

                          end repeat

                      end tell

                  end tell

                  set cnt to 0

              end PageNumbers




              Screen Shot 2015-08-10 at 6.23.37 PM.png

              • 4. Re: Inverse page numeration
                Obi-wan Kenobi Level 5

                Hi Rob,


                Excellent! Very clever idea thought to write the script.

                It doesn't actually work correctly with me [ID CC 2014]! Can you test it again? Thanks! [Soon, another great script to place in your personal folder in my ID script panel!   )

                • 5. Re: Inverse page numeration
                  rob day Adobe Community Professional & MVP

                  Try this compiled version I've included a sample ID file:



                  • 6. Re: Inverse page numeration
                    Willi Adelberger Most Valuable Participant

                    Install a MENA version.

                    1. Go to the CC desktop application
                    2. Change in the preferences the App language to any MENA language like Arabic or Hebrew
                    3. Install InDesign above your previous installed version. This will allow you to use RTL features.
                    4. Change the CC desktop app back to your primary language.
                    5. Run InDesign


                    WIth the ne document dialog you are now able to change the binding from left to right, which will reverse the order of the pages automatically.

                    • 7. Re: Inverse page numeration
                      Peter Spier Most Valuable Participant (Moderator)

                      How is that going to give both forward and reverse numbering on the same page?

                      • 8. Re: Inverse page numeration
                        Obi-wan Kenobi Level 5



                        Thanks for the sample! 


                        2 problems:


                        1/ I think it could be useful that the script works if the number page is on a specific layer: when we launch it, it creates the blocks on the "current" layer, not on the original layer.

                        2/ If I add/delete pages, the "re"-numbering doesn't work correctly! In fact, it works but, if I insert a new page 2 in a 14-pages doc., I need to launch 7 times!!! to get the good result.

                        Maybe a best way is to delete all the page number blocks at the beginning of the script!

                        • 9. Re: Inverse page numeration
                          rob day Adobe Community Professional & MVP

                          Right, I was testing on a single layer doc. I'll take a look.

                          • 10. Re: Inverse page numeration
                            rob day Adobe Community Professional & MVP

                            Wasn't layer related it was a bad repeat loop. I tested on a layered and multiple master page doc and it seems ok. The page folios have to be released in order to add the suffix so on a single layer doc they'll move to the top.


                            Try this:



                            • 11. Re: Inverse page numeration
                              Obi-wan Kenobi Level 5

                              Hi Rob,


                              Better!  But always problems in the handling of adding/removing pages and application of different master pages! 

                              • 12. Re: Inverse page numeration
                                philippeh92651011 Level 1

                                Hi Willi,


                                Changing to middle east version ddoesn't allow automaticly to get the reversed numbering.

                                I have a 36 pages document created in hebrew, with all right to left binding and paragraph. But still no way to get the pages numbering going from 36 to 1.


                                By the way if anyone here knows....?