Hello
I think I may have oversold myself there! Below is the script as it currently stands. It takes a single file and repeats placing it x ammount of times on an A3 page. After it each placement it checks to see how much space is left on the page and then, if required, adds a new page and starts again.
It's my first attempt at javascript, so I dont know if its a bit too verbose! I have had to retype it as it wouldn't paste correctly! So please excuse any spelling errors!
Could you please show me how to integrate the above in the script and how to alter the loop correctly.
Thanks for help so far!
var myDoc = app.documents.add();
myDoc.documentPreferences.pageHeight = 297;
myDoc.documentPreferences.pageWidth = 420;
var pagHeight = myDoc.documentPreferences.pageHeight;
var myY1 = 10;
var myX1 = 10;
var myY2 = 20;
var myX2 = 20;
var myPage = app.activeWindow.activePage;
var aFile = new File(“Path to my image”);
for(var i = 0; i < 20, i++){
//Make frame and place graphic
var myFrame = myPage.rectangles.add();
myFrame.geometricBounds = [myY1,myX1,myY2,myX2];
myFrame.contentType = ContentType.GRAPHIC_TYPE;
myFrame.place(aFile);
myFrame.fit(FitOptions.FrameToContent);
//Get new gb references – my use some of this at a later date!
var myGb = myFrame.geometricBounds;
var xcoord = myGb[1];
var xcoord = myGb[0];
var frameWidth = myGb[3] – myGb[1];
var frameHeight = myGb[2] – myGb[0];
if(myGb[2] >= pagHeight – frameHeight){
var myPage = myDoc.pages.add();
var myY1 = 10;
var myX1 = 10;
var myY2 = 20;
var myX2 = 20;
}else{
var myY1 = myY1 + (frameHeight + 3);
var myY2 = myY1 + frameHeight;
}
}