applyMasterPage(page, master)

Applies a master page to the given page.

The page parameter can be given as a page object, as a page name or as a page number (numbering starts at 1).

The master parameter can be given as a master spread object or as a string. If a string is used, it can either hold the master page prefix (e.g “A”, “B”) or the full name including the prefix (e.g “A-Master”, “B-Master”). The latter is useful, if there are several masters using the same prefix. Alternatively, the constant NONE can be used to apply InDesign’s [none] master to the page and thus remove the previously applied master page from the page.

Type: function

Parameter(s):

  • page {Number | String | Page}:

    The page to apply the master page to.

  • master {String | MasterSpread}:

    The master page to apply.

Returns:

  • {Page}:

    The page the master page was applied to.

Example(s):

Apply the master with prefix "B" to the documents third page

applyMasterPage(3, "B");

In a document with master pages "A-Text" and "A-Images", apply "A-Images" to the current page

applyMasterPage(page(), "A-Images");

Remove the master page from the page named "IV"

applyMasterPage("IV", NONE);