1 person found this helpful
The reference point is the point before or after which you insert a page. For instance, to add a page after page 3, you would use something like this:
doc = app.activeDocument;
myPage = doc.pages.add (LocationOptions.after, doc.pages);
When you add pages at the beginning or the end of the document, you don't use a reference.
You apply a master to a page after you've added that page:
myPage = doc.masterSpreads.item ("B-Masterspread").pages;
or pages, depending on whether you want to apply the recto or the verso.
var myDoc = app.activeDocument;
The reference object. Note: Required when the at parameter value specifies before or after. Can accept: Page, Spread, MasterSpread or Document. (Optional)
LocationOptions.AT_THE_BEGINNING should be LocationOptions.AT_BEGINNING (at least for CS3)
Thank you very much! It works!