7 Replies Latest reply: Jul 12, 2012 4:19 AM by Trevorׅ RSS

    [JS-CS5.5] How to place an image in a rectangle by name ?

    rhanot63

      Hi,

       

      I try to place an image in a rectangle by name ...

       

      var myDoc =  app.activeDocument;

      var myGraphicFile = File("/data/image.jpg");

       

      // this code work

      myDoc.rectangles.item(0).place(myGraphicFile);

      //or

      var img = myDoc.rectangles.item(0).place(new File(myGraphicFile));

       

      //this code doesn't work

      myDoc.rectangles.item("Rec1").place(myGraphicFile);

      //or

      var img = myDoc.rectangles.item("Rec1").place(new File(myGraphicFile));

       

      Have you an idea ?

      Thanks