## Commands for Master Pages

Please see the comments at the bottom of the page.

masterPageNames(...)
  `masterPageNames()`

  Returns a list of the names of all master pages in the document.

applyMasterPage(...)
  `applyMasterPage(Master Page name, page nr)`

  Applies the named master page to the indicated page. Some examples of usage are on the wiki..

closeMasterPage(...)
  `closeMasterPage()`

  Closes the currently active master page, if any, and returns editing to normal. Begin editing with editMasterPage().

createMasterPage(...)
  `createMasterPage(pageName)`

  Creates a new master page named pageName. Begin editing with editMasterPage().

deleteMasterPage(...)
  `deleteMasterPage(pageName)`

  Delete the named master page.

editMasterPage(...)
  `editMasterPage(pageName)`

  Enables master page editing and opens the named master page for editing. Finish editing with closeMasterPage().

It's important to consider how you may wish to approach working with Master Pages with Scripter. It's conceivable you may want to work with existing Master Pages, in which case you will need a list of them from masterPageNames(), after which you might present these to the user in a dialog so that one can be selected. It's more likely perhaps that you will be creating a Master Page, editing it, then applying it to one or more pages of the Document.

With this latter method, you would first use createMasterPage(), then editMasterPage(). At this point you would proceed as if you were editing any page of the Document you are working on. Once finished, you must then closeMasterPage() to continue. Note that this command takes no arguments. You may then wish some time later to applyMasterPage() in whatever fashion you choose, necessarily being careful to only choose valid page numbers – recall that pages are numbered starting with 1.

If you need to continue to edit the Document in some other fashion, it is important to realize that you must select a page to work with, using the gotoPage() command.