3 Replies Latest reply on Sep 21, 2009 10:02 AM by Danny Noonan

    [JS] [CS4] Place Rectangle over entire pasteboard

    Danny Noonan Level 1

      Is there a way to make a rectangle and place it with it's measurements the size of the paste board. I am trying to create a script that will scale a document and all elements within the document down from the center of the page.

      The reason for the rectangle is so a I can include all objects, even the ones on the pasteboard. If I were to just select every item and scale, it wouldn't scale to the center of the page because random objects on the pasteboard change the center coordinates.

       

      Any suggestions would be greatly appreciated.

      Thanks,

       

      Dan

        • 1. Re: [JS] [CS4] Place Rectangle over entire pasteboard
          [Jongware] Most Valuable Participant

          The page itself is still at the center, right?

          Use app.activeDocument.documentPreferences.pageHeight and app.activeDocument.documentPreferences.pageWidth to get its dimensions, multiply width by 2 if you have spreads (), then divide both by 2 to get the center.

          1 person found this helpful
          • 2. Re: [JS] [CS4] Place Rectangle over entire pasteboard
            Kasyan Servetsky Level 5

            Here is my way of making Яectangles on the pasteboard:

             

            #target indesign
            var myDoc = app.documents.add();
            var myPage = myDoc.pages[0];
            var myPageBounds = myPage.bounds;
            var myPageWidth = myDoc.documentPreferences.pageWidth;
            var myPageHeight = myDoc.documentPreferences.pageHeight;
            var myMinVertOffset = myDoc.pasteboardPreferences.minimumSpaceAboveAndBelow;
            var myY1 = -myMinVertOffset;
            var myY2 = myMinVertOffset + myPageHeight;
            var myX1 = -(myPageWidth * 2);
            var myX2 = myPageWidth * 2;
            myPage.rectangles.add({geometricBounds: [myY1, myX1, myY2, myX2], fillColor:myDoc.swatches.item("Black"), fillTint:20});

            1 person found this helpful
            • 3. Re: [JS] [CS4] Place Rectangle over entire pasteboard
              Danny Noonan Level 1

              Thanks for your assistance, with you help I am off to a good start.  I'll let you know if I have any more questions.

              I am learning javaScript and you guys have been a tremendous resource. I appreciate your quick and knowledgeable responses.

               

              Thanks again,

               

              Dan