4 Replies Latest reply on Jun 6, 2013 8:41 AM by big_smile

    Change Page size with a Script

    big_smile Level 1

      I have made artwork in Illustrator that is set up as two page spreads on 1 artboard.

       

      I need to convert this to single page spreads.

       

      I.e. So for half the documents, I need to set the anchor point of the document to top left and half the width of the artboard.

      For the other half of the documents, I need to set anchor point to to right and half the width.

       

      Is this possible with scripting?

       

      I have look around online to find ways of accessing the document size and anchor point via scripting, but cannot seem to find any resources.

       

      Thanks for any help that can be offered.

       

      Edit: Also is it possible to create a new artboard with a script and assign it a name?

        • 1. Re: Change Page size with a Script
          Muppet Mark Level 5

          Without a picture of the artwork its a little guesswork… I would suspect that you could change the existing artboard's rectangle or add a new one and remove the old…

          • 2. Re: Change Page size with a Script
            big_smile Level 1

            Without a picture of the artwork its a little guesswork… I would suspect that you could change the existing artboard's rectangle or add a new one and remove the old…

            Thanks for the reply!

            I have found you can do this with doc.visibleBounds However, is it possible to create two artboards in one document with a script. E.g. so I can have one artboard for the left side spread and another artboard for the right side?

             

            Thanks!

            • 3. Re: Change Page size with a Script
              CarlosCanto Adobe Community Professional & MVP

              here you go, this script splits the artboard in two

               

              // carlos canto
              // http://forums.adobe.com/message/5380624#5380624
              
              var idoc = app.activeDocument;
              var ab = idoc.artboards[0];
              var abBounds = ab.artboardRect;// left, top, right, bottom
              
              
              var ableft = abBounds[0]; // 0
              var abtop = abBounds[1]; // 612
              var abright = abBounds[2];
              var abbottom = abBounds[3];
              var abwidth = abright - ableft; // 792 // width
              var abheight = abtop- abbottom; // 0 // height
              
              
              var half = ableft + abwidth/2;
              
              
              var abright2 = half;
              ab.artboardRect = [ableft, abtop, abright2, abbottom];
              
              
              var ableft2 = half;
              var newAB = idoc.artboards.add([ableft2, abtop, abright, abbottom]);
              
              • 4. Re: Change Page size with a Script
                big_smile Level 1

                That's excellent, thanks!