Skip to main content
Inspiring
November 7, 2016
Answered

Moving embedded graphic to another frame

  • November 7, 2016
  • 1 reply
  • 1261 views

Hi all,

I am trying to move an embedded graphic from its container to another one. Nor duplicate nor move seems to offer such ability.

I wish to avoid place command. I was more trying to re-affect the container's graphic instance.

Any idea ?

TIA Loic

This topic has been closed for replies.
Correct answer Laubender

Hi Loic,

yes. :-)

Select the frame that is holding your portrait image.
Shift click the other graphic frame to add it to the selection and run this snippet:

var graphic = app.selection[0].graphics[0];

var target = app.selection[1];

target.contentPlace([graphic]);

Cheers,
Uwe

1 reply

LaubenderCommunity ExpertCorrect answer
Community Expert
November 7, 2016

Hi Loic,

yes. :-)

Select the frame that is holding your portrait image.
Shift click the other graphic frame to add it to the selection and run this snippet:

var graphic = app.selection[0].graphics[0];

var target = app.selection[1];

target.contentPlace([graphic]);

Cheers,
Uwe

Inspiring
November 7, 2016

Thanks Uwe,

I gave contentPlace a try before I post there and couldn't get it to work. Obviously I was misusing it !

Community Expert
November 7, 2016

Hi Loic,

well, sometimes DOM documentation is a bit misleading ;-)

Example: You'll find contentPlace() also with [object Group], but I could not find a way yet to contentPlace an object directly as member of a group. An error will be thrown if you try.

Also: If you feed  contentPlace() with more than one object in the array the objects will not be placed inside the target, but directly on the spread of the target. Stacked to and distanced from each other. Where the distance follows a rule that I still have to figure out.

Example where the source is on spread 1 and the target is on spread 2:

Code:

var doc = app.documents[0];

var arrayToPlace = doc.spreads[0].pages[0].allPageItems;

var target = doc.spreads[1].pages[0].pageItems[0];

var result = target.contentPlace(arrayToPlace);

app.select(result);

Result after running the snippet:

And in this case no error message is thrown…

Just an example…

Regards,
Uwe