1 Reply Latest reply on Jun 16, 2011 2:10 PM by Muppet Mark

    Multiple Page Size

    dim82

      Hi.

      I have Microsoft Excel list of documents sizes.How can i create Multiple Page Size document using script?

      And can i give name pages instead of numbers?

        • 1. Re: Multiple Page Size
          Muppet Mark Level 5

          Well, I had a look at this and its all pretty new to me… I have had a problem trying to work out why it wants/works with 'points units' I've tried several permutations but can't seem to fix it… Maybe someone else knows…? All I did was try resize the pages… some appear to have a black edge in the GUI but I don't know what thats about? The dummy info should be straight forward to swap for read a CSV text file. As for naming I think not better to label…

           

          #target indesign
          
          var dummyInfo = [
               ['Alf',2000,1000],
               ['Bert',3000,500],
               ['Erni',1000,2000],
               ['Fred',2000,250],
               ['Ken',1000,1000],
               ['Stan',4000,1000],
          ];
          
          app.activate();
          
          app.scriptPreferences.enableRedraw = true;
          
          //app.scriptPreferences.measurementUnit = MeasurementUnits.MILLIMETERS;
          
          app.scriptPreferences.userInteractionLevel
               = UserInteractionLevels.NEVER_INTERACT;
          
          var doc = app.documents.add();
          
          doc.documentPreferences.facingPages = false;
          
          doc.marginPreferences.top = 0;
          doc.marginPreferences.bottom = 0;
          doc.marginPreferences.left = 0;
          doc.marginPreferences.right = 0;
          
          doc.viewPreferences.horizontalMeasurementUnits
               = MeasurementUnits.MILLIMETERS;
               
          doc.viewPreferences.verticalMeasurementUnits
               = MeasurementUnits.MILLIMETERS;
               
          doc.viewPreferences.rulerOrigin
               = RulerOrigin.SPREAD_ORIGIN;
          
          // We will remove this whatever size it was
          var defaultPage = doc.spreads.firstItem().pages.firstItem();
          
          defaultPage.appliedMaster = NothingEnum.NOTHING;
          
          // Loop our new page info
          for ( var i = 0; i < dummyInfo.length; i++ ) {
               
               var newPage = doc.pages.add();
               
               newPage.label = dummyInfo[i][0];
               
               newPage.resize(CoordinateSpaces.SPREAD_COORDINATES, [0,0],
               ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,
               [dummyInfo[i][1],dummyInfo[i][2]], false, true);
               
          }
          
          defaultPage.remove();
          

           

          Not sure if all of that is needed but resize was fussy about margins…