6 Replies Latest reply on May 3, 2013 3:01 AM by shilpa25

    Resize textFrame between margins

    shilpa25 Level 1

      Hi Forum,

       

      This is the script, that will add textFrames to the specified location. My request is to add textFrame, within the page marings, bottom of the page. (margin may change according to the job size).

       

      if (app.documents.length != 0){

         var myDocument = app.activeDocument;

                ViewPreference.rulerOrigin = RulerOrigin.pageOrigin;

                myDocument.zeroPoint = [0,0];

                with(myDocument){

                var myPage = myDocument.pages.item(0);

                with (myDocument.documentPreferences){

                var myPageHeight = pageHeight;

                var myPageWidth =  pageWidth;}

                var myTextFrame = textFrames.add();

                myTextFrame.geometricBounds = [ myPageHeight-2.5, myPageWidth-6.5, myPageHeight-1, myPageWidth-1];

                myTextFrame.contents = "XXXXXX"

                var myParagraph = myTextFrame.paragraphs.item(0);

                with (myParagraph) {

                appliedFont = app.fonts.item("Helvetica Neue LT Pro")

                 fontStyle = "55 Roman"

                pointSize = 4

                justification = Justification.rightAlign

                 }

       

       

      Can any one twek on the geometric Bounds... and help to add textFrames between page marings.

       

       

      thanks & regards

        • 1. Re: Resize textFrame between margins
          Vamitul Level 4

          you can get the page margins using page.marginPreferences (.top, .bottom, etc)

          http://jongware.mit.edu/idcs5/pc_MarginPreference.html

          1 person found this helpful
          • 2. Re: Resize textFrame between margins
            shilpa25 Level 1

            Hi Vam & Forum,

             

            I have tried in many methods, but i cannot move the textframe between margin and slug. (i do not want to keep value [0,5] etc, margin height and slug height is not fixed,   will be changing document to document).

            //[ because the

            atlast i tried like this,,

             

            myTextFrame.geometricBounds = [page.bounds[0] + myPageHeight+ page.marginPreferences.bottom, page.bounds[1], page.bounds[2],  page.bounds[3]];

                                myTextFrame.fit(FitOptions.FRAME_TO_CONTENT);

             

            now, the textframe starts just below the PageBottom edge.

             

            How I then move the textframe between the page bottom - margin and slug...

             

            thanks,,,

            1 person found this helpful
            • 3. Re: Resize textFrame between margins
              shilpa25 Level 1

              Hi Forum,

               

              also instead fo getting alert for geometricBounds values,

               

              myTextFrame = app.activeDocument;

              page  =app.activeDocument.pages.item(0);

              alert(myTextFrame.textFrames.item(0).geometricBounds);

               

               

              how can we get alert like this....

               

              myTextFrame.geometricBounds = [page.bounds[0] + myPageHeight+ page.marginPreferences.bottom, page.bounds[1], page.bounds[2],  page.bounds[3]];

              1 person found this helpful
              • 4. Re: Resize textFrame between margins
                shilpa25 Level 1

                Im not sure!

                 

                Atleast, i have made to shrink the textFrame with the options. FitFrame to contents,

                 

                however, can move it between margins and slug.

                 

                Can anybody look at it this and help me!...

                 

                myTextFrame.geometricBounds = [page.bounds[0] + myPageHeight+ page.marginPreferences.bottom, page.bounds[1], page.bounds[2],  page.bounds[3]];

                 

                myTextFrame.fit(FitOptions.FRAME_TO_CONTENT);

                 

                Now the Frame is just below the page bottom edge. & i tried and tried to move between the bottom margins and bottom slug....

                 

                advance thanks & regards,

                1 person found this helpful
                • 5. Re: Resize textFrame between margins
                  SureshRaji Level 2

                  Hi Shilpa,

                   

                  Is this the one you need:

                   

                  myTextFrame.geometricBounds = [myPageHeight - myPage.marginPreferences.bottom, myPage.bounds[1], myPage.bounds[2] + myDocument.documentPreferences.slugBottomOffset,  myPage.bounds[3]];
                  

                   

                  Suresh

                  • 6. Re: Resize textFrame between margins
                    shilpa25 Level 1

                    Hi Suresh,

                     

                    thanks so much suresh,

                     

                    from yours, i derived this.....

                     

                    My intention is to set textframe between bleed and slug....

                     

                    You have give me a best out of best to solve my problem.....thanks...

                     

                    myTextFrame.geometricBounds = [myPageHeight + documentPreferences.documentBleedBottomOffset, myPage.bounds[1], myPage.bounds[2] + myDocument.documentPreferences.slugBottomOffset,  myPage.bounds[3]];

                     

                    Here you go with points.....