2 Replies Latest reply on Dec 9, 2012 11:40 AM by Pickory

    New textframe on any page

    Pickory Level 3

      Hello,

       

      I am sure this is simple but I have been struggling with it all day.

       

      I want to add a text frame to the top left of any page of my document.

       

      Here is what I have done.

       

      aPage = doc.pages[nn];

      . . .

      newTextFrame = aPage.textFrames.add( undefined, undefined, undefined, {geometricBounds:["0pt","0pt","100pt","100pt"] } );

       

      I get a textframe on the left page. If the spread has two pages I get two textframes on page 1 of the spread.

       

      Very grateful for any help.

       

      Thanks.

       

      P.

        • 1. Re: New textframe on any page
          -hans- Level 4

          Hi,

           

          guess it's cause of a Spread.origin. try:

           

          currDoc = app.activeDocument;
          currOrigin = currDoc.viewPreferences.rulerOrigin;
          currDoc.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
              
          currDoc.pages.everyItem().textFrames.add( undefined, undefined, undefined, {geometricBounds:["0pt","0pt","100pt","100pt"] } );
          
          currDoc.viewPreferences.rulerOrigin = currOrigin;
          
          • 2. Re: New textframe on any page
            Pickory Level 3

            Thank you so much!

             

            doc.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;

             

            That did the trick.

             

             

            P.