• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Issue with Overriding Master Page Items in InDesign Server 2024

New Here ,
Aug 06, 2024 Aug 06, 2024

Copy link to clipboard

Copied

I've been using InDesign's desktop version for a while and was accustomed to overriding all master page items using:

 

app.menuActions.itemByName("$ID/Override All Master Page Items").invoke();

However, now that I'm working with InDesign Server 2024, I encounter issues with overriding all master page items. I've been trying to adapt my script to this new environment and have the following code:

 

function overrideMasterItems(page, masterSpread) {
    var masterPageItems = masterSpread.pageItems.everyItem().getElements();

    for (var i = 0; i < masterPageItems.length; i++) {
        var masterItem = masterPageItems[i];

        try {
            var bounds = masterItem.geometricBounds;
            var overriddenItem = masterItem.override(page);

            overriddenItem.geometricBounds = bounds;

            if (overriddenItem.allPageItems.length > 0) {
                for (var j = 0; j < overriddenItem.allPageItems.length; j++) {
                    var childItem = overriddenItem.allPageItems[j];
                    var childBounds = childItem.geometricBounds;
                    childItem.override(page);
                    childItem.geometricBounds = childBounds;
                }
            }
        } catch (e) {}
    }
}


Despite this, the script doesn't work as expected. Specifically, it seems that not all master page items are being overridden correctly.

Has anyone experienced similar issues or have suggestions for how to properly override master page items in InDesign Server 2024?

Thank you in advance for your help!

TOPICS
Bug , Scripting

Views

106

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 06, 2024 Aug 06, 2024

You make life too difficult for yourself. To override all page items from a master page on to a document page, use this:

function overrideMasterItems (page) {
  var m = page.masterPageItems;
  for (var i = m.length-1; i >= 0; i--) {
    m[i].override (page);
  }
}

Votes

Translate

Translate
Community Expert ,
Aug 06, 2024 Aug 06, 2024

Copy link to clipboard

Copied

Not sure why do you need internal loop - when you override parent / container / item that is directly on the page - everything "inside" will be overriden as well. 

 

Your catch...try part is ignoring errors - so you should either disable it or log errors.

 

Locked / hidden  layers / objects won't be overriden. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 06, 2024 Aug 06, 2024

Copy link to clipboard

Copied

LATEST

You make life too difficult for yourself. To override all page items from a master page on to a document page, use this:

function overrideMasterItems (page) {
  var m = page.masterPageItems;
  for (var i = m.length-1; i >= 0; i--) {
    m[i].override (page);
  }
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines