Copy link to clipboard
Copied
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
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Thanks Uwe,
I gave contentPlace a try before I post there and couldn't get it to work. Obviously I was misusing it !
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Nice to know