🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #9040

Re: Putting all the elements from one page into another page

#9040
From: thechrisproject
Date: Wed, 13 Sep 2006 21:30
23 lines
2104 bytes
I've been working on this a little more and now have a situation where I need to move all the elements from two pages on two seperate documents to a single page on a target document. So the duplication isn't cutting it anymore.

What I've been doing for the moment is duplicating the pages from the source documents into the target document, then looping over the pages in the new document and moving all the pageItems to the proper page in the target document. Then I delete the page I moved everything off of. This works alright, but all positioning information is lost for the pageItems. They're on the right page, but all in the upper left corner. When I try to extract the pageItem positioning info and apply it to the moved pageItems, nothing seems to happen. Here's the code I'm using:

	//duplicate into workingDoc at end
	var fragment = app.open(fragFile);
	fragment.pages[0].duplicate(LocationOptions.after, workingDoc.pages[workingDoc.pages.length-1]);
	fragment.close();
	fragFile.close();

	//move elements to proper page
	var sourcePage = workingDoc.pages[workingDoc.pages.length-1];
	var destinationPage = workingDoc.pages[destPageNumber];
	while(sourcePage.pageItems.length > 1)
	{
		var item = sourcePage.pageItems[0];
		var xOffset = item.geometricBounds[1];
		var yOffset = item.geometricBounds[0];
		item.move(destinationPage);
		var moveArray = [xOffset, yOffset];
		item.move(moveArray);
	}
	sourcePage.remove();
Technical Details
Message-ID: <3bc17bef.7@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!news.germany.com!news.isoc.lu!webcrossing
References: <3bc17bef.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,148c206390c52d9f,start
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: thechrisproject@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!news.germany.com!news.isoc.lu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: Putting all the elements from one page into another page
Message-ID: <3bc17bef.7@webcrossing.la2eafNXanI>
Date: Wed, 13 Sep 2006 14:30:16 -0700
References: <3bc17bef.-1@webcrossing.la2eafNXanI>
Lines: 34
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit