1 Reply Latest reply on Nov 28, 2008 8:00 AM by Loic.Aigon

    [CS2][JS]Page Numbering but not Page Number

    Level 1
      Please help javascript heroes.
      I am working on this doument that has a pagination but it requires an id line where i have to put the number of page but not the actual pagination. I know it sounds weird but to make the picture clearer:

      the header of the page is 469 to 524
      but on the footer it should be 1 to 56.

      is there anyway i can do this on the master page so i won't have to do this manually on the footer of each individual page?
        • 1. Re: [CS2][JS]Page Numbering but not Page Number
          Loic.Aigon Adobe Community Professional
          Here is a non finished version:

          if(app.documents.length!=0)
          {
          var doc = app.activeDocument;
          var pg = doc.pages;
          mydlg();
          }
          else
          {
          alert("No documents open !");
          }

          function mydlg()
          {
          var start = pg[0].name;
          var end = pg[-1].name;
          var mydlg = app.dialogs.add({name:"False folio 1.0"});
          with(mydlg)
          {
          with(dialogColumns.add())
          {
          with(dialogRows.add())
          {
          staticTexts.add({staticLabel:"From page"});
          var startField = realEditboxes.add({editValue:Number(start), minWidth:30});
          staticTexts.add({staticLabel:"to page"});
          var endField = realEditboxes.add({editValue:Number(end), minWidth:30});
          }
          }
          }
          if(mydlg.show()==true)
          {
          falseFolioLayer();
          var l = doc.layers.item("falseFolio");
          var start = startField.editValue;
          var end = endField.editValue
          var lg =Number(end) - Number(start);
          $.writeln(lg);
          for(i=1; i<=end; i++)
          {
          var index = Number(start)-2+i;
          if(String(i/2).indexOf(".")==-1)
          {
          x1 = 2*pageAttr(doc)[0]-pageAttr(doc)[4]-25;
          x2 = 2*pageAttr(doc)[0]-pageAttr(doc)[4];
          }
          else
          {
          x1 = 0+pageAttr(doc)[2];
          x2 = x1+25;
          }
          var y1 = pageAttr(doc)[1]-pageAttr(doc)[3]-10;
          var y2 = y1+10;
          var folio = pg[index].textFrames.add(l,{geometricBounds:[y1,x1,y2,x2]});
          with(folio)
          {
          contents = String(i)+"/"+lg;
          textFramePreferences.verticalJustification = VerticalJustification.BOTTOM_ALIGN;
          texts[0].justification = Justification.AWAY_FROM_BINDING_SIDE;
          }
          }
          }
          }

          function falseFolioLayer()
          {
          var l = doc.layers;
          for(i=l.length-1; i>=0; i--)
          {
          if(l[i].name=="falseFolio")
          {
          l[i].remove();
          }
          }
          l.add({name:"falseFolio"});
          }

          function pageAttr(doc)
          {
          h = doc.documentPreferences.pageHeight;
          w = doc.documentPreferences.pageWidth;
          mb = doc.marginPreferences.bottom;
          ml = doc.marginPreferences.left;
          mr = doc.marginPreferences.right;
          return [w,h,ml,mb,mr];
          }