Skip to main content
Lordrhavin
Inspiring
September 24, 2024
Question

Copying and Relinking Page Items While Maintaining Position and Rotation in InDesign

The following function is supposed to copy the items on page src to page dst. That works on simple items.

 

 

 

function copyPageContent(src, dst) {
	itemsOnPage = src.pageItems;
	for (var e = 0; e < itemsOnPage.length; e++) {
		gb = itemsOnPage[e].geometricBounds;
		pos = [gb[1], gb[0]];
		duped = itemsOnPage[e].duplicate(dst);
		duped.move(pos);
	}
}

 

 

 

But if i have 2 Items on the page src that are linked (being src.Item-A the original and src.Item-B the link to src.Item-A), on the copied page, the newly copy dst.Item-B is still linked to the original src.Item-A on page src. I want it to be linked to the dst.Item-A on the page dst.

Also, if the src.Item-B is rotated by 180° and put below the src-Item-A, its copy dst.Item-B is also rotated but put left of dst.Item-A. In other words: its right-down corner is put where its upper-left corner should be.


How can I unlink dst.Item-B from src.Item-A, link it to dst.Item-A and how can I correctly position it? 

 

<Title renamed by MOD>

This topic is closed to new replies. Start a new post to keep the conversation going.

9 replies

Robert at ID-Tasker
Legend
September 24, 2024

@Lordrhavin

 

How about Ctrl+A, Ctrl+G, Ctrl+C, Ctrl+Alt+Shift+V, Ctrl+Shift+G? 

 

But it might require extra tweaking - depends on (0,0) point and its origin. 

 

And Paste Remembers Layers should be enabled. 

 

Translate
Lordrhavin
Inspiring
September 24, 2024

How about SCRIPTING?

Translate
Robert at ID-Tasker
Legend
September 24, 2024
quote

How about SCRIPTING?


By @Lordrhavin

 

Every command on the list can be invoked - sorry, I thought you were aware of that: 

 

https://creativepro.com/files/kahrel/indesign/menu_actions.html

 

Of course, few extra steps would be needed - making dst page active, etc. 

 

Translate
leo.r
Community Expert
Community Expert
September 24, 2024

i assume you'd need to check each item's linkedPageItemOption and then use the contentPlace method, but that's just a raw guess. 

Translate
leo.r
Community Expert
Community Expert
September 24, 2024

...also, if you just duplicate the entire page/spread it should do what you need (provided such a duplication is suitable for the final purpose of your operation)  

Translate
Lordrhavin
Inspiring
September 24, 2024

It's not. I cant dublicate a masterSpread.page as a normal page.

This is how I call it:

var page = pages.add();
copyPageMetrics(master.pages[0], page);
page.appliedMaster = master.appliedMaster;
copyPageContent(master,page);

Translate