I have a document with a spread that is far larger than the contents contained in the document. http://i36.photobucket.com/albums/e50/nollaf126/1-oversize-pasteboard.png
I have another template file with a spread that matches the size of the bounds of the all the selected objects. I need to open that template, paste the objects, have that pasted selection of objects align to the top left of the spread (aka pasteboard or work area?), and then export as .pdf and .eps.
Due to lots of confusion regarding various coordinate systems, my ideal solution would be to not have to move anything at all, but instead, have the upper left corner of the pasted contents align with the upper left corner of the spread as it is pasted. Neither paste nor paste-in-place puts the contents where I need them. The objects are too low. http://i36.photobucket.com/albums/e50/nollaf126/2-contents-pasted-too-low.png
Even if there is a solution to paste the information where it needs to go from the outset, I'd still like to know how to move things relative to the visible work area (I believe this is correctly referred to as the spread, but more commonly called the pasteboard? I just want to make sure I'm asking my question correctly so my intentions will be understood).
My first try with the following line of code produces the result seen in the following image; only the background .eps object is moved, and it moves down.
app.selection[0].move([myPage.bounds[0]+myMargins.top,myPage.bounds[1]+myMargins.left]);
i36_photobucket_com/albums/e50/nollaf126/3-first-try-to-move.png
My second try is illustrated below; it also seems to only reposition the background image, but something is also moved very far down and to the right. It appears that it may be the same size and shape as the spread from which I copied the objects. The selection bounds were the correct size when I first pasted the object into the new document, until the line of code to change the geometric bounds was executed.
app.selection[0].geometricBounds = [myPage.bounds[0]+myMargins.top,myPage.bounds[1]+myMargins.left,myPage.bounds[2]-myMargins.bottom,myPage.bounds[3]-myMargins.right];
//
i36_photobucket_com/albums/e50/nollaf126/4-2nd-try-to-move.png
Also, previous attempts (before I added the image of the tiger, the text to its immediate left, and a red rectangle behind the tiger) saw all the selected objects EXCEPT the background .eps image move up and into the proper position using the app.selection[0].geometricBounds statement.
Any help would be very greatly appreciated. Here's the code and a screenshot of the objects on the layer that are involved.
i36_photobucket_com/albums/e50/nollaf126/5-layers.png
#target indesign-11.064 // CC 2015
myDoc = app.activeDocument;
myPages = app.activeDocument.pages;
myActivePage=app.activeWindow.activePage;
// 1. Select and copy everything on this document's activePage
app.select(SelectAll.ALL);
app.copy();
// 2. Open template file and paste
whichExportTemplate = "FCILG";
myTemplateFolder="/Users/User/Documents/! Resources/ Templates/ Ted Signs/ Tags";
sFileName= myTemplateFolder + "/" + whichExportTemplate + ".indd"
sFileName= sFileName.replace (/%20/g, " ");
newDoc = app.open(File(sFileName));
app.pasteInPlace();
app.select(SelectAll.ALL);
// 3. POSITION IT
var myPage = myActivePage;
var myMargins = myPage.marginPreferences;
app.selection[0].geometricBounds = [myPage.bounds[0]+myMargins.top,myPage.bounds[1]+myMargins.left,myPage.bounds[2]-myMargins.bottom,myPage.bounds[3]-myMargins.right];
// app.selection[0].move([myPage.bounds[0]+myMargins.top,myPage.bounds[1]+myMargins.left]);
// 4. Save the new file
// 5. Close