3 Replies Latest reply on Jun 26, 2011 11:58 PM by Andreas Jansson

    Conditional text based on page side?

    xmlapi Level 1

      I have two text frames on the left and right side of each page. If it's a left hand page, I want to show the left frame, if it's a right hand page, I want to show the right frame.

       

      Is there any automatic feature to do this or do I have to use a script to manually go through each page and show/hide the frames based on page side?

        • 1. Re: Conditional text based on page side?
          Andreas Jansson Level 2

          Unless there are other differences between the left and right frame, I'd look into the anchoring options for text frames. I believe there are options such as "away from spine", and other, that can automatically place an anchored textframe depending on left or right.

           

          Consider this a mere hint, since I don't fully grasp the situation / problem. (Eg. is scripting already involved, are you importing xml or is it a "plain template" that you are setting up?)

           

          Best regards,

          Andreas

          • 2. Re: Conditional text based on page side?
            xmlapi Level 1

            Scripting is involved since it is an automated process where it imports XML, does a couple of modifications, and exports a PDF for each XML file.

             

            On each page, I have a main text frame (the main content area) and a left side placeholder and a right side placeholder. Left pages need to display the left side placeholder etc.

             

            How do I use anchored objects to set left and right? what options do I exactly set in the anchored object options?

            • 3. Re: Conditional text based on page side?
              Andreas Jansson Level 2

              You'll have to figure out whether this can help you at all, by setting up a document by hand first. Paste a textframe at the cursor position in you main text, select the new object, and then right-click and select anchored object.

               

              Capture1.JPG

               

              Capture2.JPG

               

              There you can set up the anchored object to appear a certain distance from the spine.

               

              I'm not sure how to handle this within an xml-import. Try tagging the anchored frame, and see what happens.

               

              If it seems to work out, you would probably use TextFrame.anchoredObjectSettings to set things up from the script.

              I get this result, checking the existing properties of an anchored textframe in a document:

               

              app.selection[0].anchoredObjectSettings.reflect.properties
              Result: reflect,

              anchoredPosition,

              spineRelative,

              lockPosition,

              pinPosition,

              anchorPoint,

              horizontalAlignment,

              horizontalReferencePoint,

              verticalAlignment,

              verticalReferencePoint,

              anchorXoffset,

              anchorYoffset,

              anchorSpaceAbove,

              isValid

              ...

               

              You could also look up "AnchoredObjectSetting"  in the Object Model Viewer, in the Extendscript Toolkit, to see all it's settings.

               

              Best of luck to you!