4 Replies Latest reply on Jan 10, 2011 4:58 AM by Frank Ypma

    TransformReferencePoint indesign server

    Frank Ypma



      How can i change the transformreferencepoint for indesign server?


      app.layoutwindows.firstItem.transformReferencePoint = 1095660652 is not working because layoutwindows doesn't exist in indesign server.

      I really need this setting because i move and create rectangles and my input coordinations are top-left while indesign servers is set to top-right.



      Kind regards

        • 1. Re: TransformReferencePoint indesign server
          Kasyan Servetsky Level 5

          I suggest you to use the transform method where the 2nd parameter -- from -- can be AnchorPoint.



          • 2. Re: TransformReferencePoint indesign server
            Frank Ypma Level 1

            Thx for the fast answer!


            That's good for settings the coordinates, but i also need to load the coordinates with top-left

            are these coordinates always top-right in indesign server?

            if so i can change the way i load  my bounds (but then i need to be 100% sure).

            • 3. Re: TransformReferencePoint indesign server
              Kasyan Servetsky Level 5

              Let's say that you want to scale a rectangle by 50% relative to bottom right anchor point.

              I know two ways of achieving this in desktop version of InDesign:

              var doc = app.activeDocument;
              // remember anchor point
              var oldAnchorPoint = doc.layoutWindows[0].transformReferencePoint;
              // set it to bottom right
              doc.layoutWindows[0].transformReferencePoint = AnchorPoint.BOTTOM_RIGHT_ANCHOR;
              var rec = doc .rectangles[0];
              rec.absoluteVerticalScale = 50;
              rec.absoluteHorizontalScale = 50;
              // restore the original anchor point
              doc.layoutWindows[0].transformReferencePoint = oldAnchorPoint;


              This approach should work in ID server since it doesn't use layoutWindows.

              var doc = app.activeDocument;
              var rec = doc.rectangles[0];
              app.transformPreferences.whenScaling = WhenScalingOptions.adjustScalingPercentage;
              var transformationMatrix =  app.transformationMatrices.add({horizontalScaleFactor:.5, verticalScaleFactor:.5}); 
              rec.transform(CoordinateSpaces.PARENT_COORDINATES, AnchorPoint.BOTTOM_RIGHT_ANCHOR, transformationMatrix);


              Both snippets give the same result.



              • 4. Re: TransformReferencePoint indesign server
                Frank Ypma Level 1

                I've found the problem :


                Coordinates are always loaded from top-left bottom - right but that's not the case when your object is rotated.

                when the object is rotated it uses the y-coordinate that is closed to the top (so sometimes top-left othertimes top-right).


                In order to fix this (then i always have the correct coordinates):


                rotation = myFrame.RotationAngle

                myFrame.RotationAngle = 0

                myBounds = myFrame.geometricBounds

                myFrame.RotationAngle =  rotation