2 Replies Latest reply on Mar 27, 2009 2:51 AM by (Saranya_Harikrishnan)

    Urgent: Duplicating rectangle to new page. Trouble in fixing the coordinates

      Hi,

      Adobe Indesign CS3 Server Object model:
      Javascripting using extended toolscript version 5
      Windows

      I have tried to duplicate a rectangle from a previous page, to a new page with the following code.

      var oldPage = myDocument.pages.item(0)
      var newPage = myDocument.pages.item(1)
      var oldPageRect = oldPage.rectangles;
      var newRecOnNewPage = oldpageRect.item(0).duplicate(newPage)

      the geometric coordinates of the the recatngle that was duplicated,
      one on the first page, (13.5, 35.0416, 23.5, 45.0416)

      However the duplicate rectangle on the second sheet, showed
      (13.5, 185.0416, 23.5, 195.0416)...(Please Note:The coordinates have not been exactly quoted)

      This made me think, that perhaps, the (0,0) of the page lies on the first page, and the second page is considered an appendage added to the first page, horizontally.

      I would like to know, how to disassociate the relative scale of the rectangle from the axis on the first page, and allow it to be considered as a new object lying on a x, y coordinate plane based on the second page alone.

      This is Urgent! Kindly help resolve

      Thanks in advance,
      Saranya Harikrishnan
        • 1. Re: Urgent: Duplicating rectangle to new page. Trouble in fixing the coordinates
          [Jongware] Most Valuable Participant
          Examining the options for rules on your screen would help you. The numbers returned match those given in the interface, and if you need per-page rules in the interface, you'd change them.

          Since this is for a script, you can
          * store the current setting of the rules in a variable
          * set it to your needs
          * do measurements, object placement
          * restore to the old setting.
          That way the script doesn't (permanently) change settings the user would have set by himself.

          The script options for rulers allow the same choices as in the UI:

          "RulerOrigin.SPREAD_ORIGIN The zero point is at the top-left corner of the spread and the ruler increments continuously across all pages of the spread.
          RulerOrigin.PAGE_ORIGIN The top-left corner of each page is a new zero point on the horizontal ruler.
          RulerOrigin.SPINE_ORIGIN The zero point is at the top-left corner of the left-most page and at the top of the binding spine. The horizontal ruler measures from the leftmost page to the binding edge, and from the binding spine through the right edge of the right-most page. Also locks the zero point and prevents manual overrides."
          • 2. Re: Urgent: Duplicating rectangle to new page. Trouble in fixing the coordinates
            Level 1
            Hi,

            Thank you very much for your suggestion. The issue was resolved when I set the view preferences to RulerOrigin.Page_Origin.

            Thank you once again :)

            Saranya Harikrishnan