Reverse Numbering

Tagged: 

Viewing 2 reply threads
  • Author
    Posts
    • #80131

      Hi guys, I’m working for a publisher very innovative. He wants to reverse the page number. If the book is made of 200 pages he wants the first page with number -200 and the last page with number 0
      How can I do this?
      Ok I know i could do this manually but you know it will be very difficult for further editing (one new page in the middle and i should re-number all the book).
      Please help me!
      thanks a lot
      Alessio

    • #80151
      Peter Kahrel
      Participant

      Should be fairly simple, though I haven’t seen your document. Prepare your document as follows: on each master page place a text frame for the page number and name it ‘folio’ (without the quotes) on the Layers panel. Then run this script:

      (function () {
        var i, index;
        var frame;
        var n = 1;
        var pages = app.documents[0].pages.everyItem().getElements();
        for (i = pages.length-1; i >= 0; i--) {
          n--;
          if (pages[i].textFrames.item('folio').isValid) {
            pages[i].textFrames.item('folio').remove();
          }
          if (pages[i].appliedMaster !== null) {
            index = pages[i].side === PageSideOptions.LEFT_HAND ? 0 : 1;
            frame = pages[i].appliedMaster.pages[index].textFrames.item('folio');
            if (frame.isValid) {
              frame = frame.duplicate (pages[i]);
              frame.contents = String(n);
            }
          }
        }
      }());

      When you add and/or delete pages, simply run the script again.

      Peter

    • #80179

      Peter you are really a good person, thank you so much. I tried the script and it works perfectly!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.
>