3 Replies Latest reply on Feb 15, 2016 9:11 AM by Kasyan Servetsky

    Problem with placing image to a frame which is located partially on page

    Kasyan Servetsky Level 5

      Hi all,


      I have a graphic frame which partially overlaps the page, like so:

      15-02-2016 13-12-50.png


      When I’m trying to place an image by script, I get an error: “This value would cause one or more objects to leave the pasteboard.” Though, I can place it manually in InDesign without any issues. I wonder why I’m unable to do this by the script.

      function Main() {
          var doc = app.activeDocument;
          var imgFile = new File("~/Desktop/Test.jpg");
          // Select the rectangle to place the image
          var rec = app.selection[0];
          try {
              var img = rec.place(imgFile);
          catch(err) {
              $.writeln(err.message + ", line: " + err.line);


      Of the top of my head, a workaround -- in the catch block do the following:

      1. remember the frame’s original geometric bounds
      2. align the problematic frame to the center of the page
      3. place the image
      4. move the frame back to its original position


      Maybe someone may suggest a more elegant solution?


      Here’s the indd-file I used for testing.