Skip to main content
graphozzie
Participating Frequently
November 6, 2025
Answered

Appliquer un gabarit aux pages imparies d'un document indesign

  • November 6, 2025
  • 3 replies
  • 232 views

Bonjour,

La boîte de dialogue "Appliquer un  gabarit aux pages..." du panneau Pages est extrêmement succincte, en particulier, le champ "Aux pages" ne possède comme choix préenregistré que "Toutes les pages". N'existe-t-il pas un moyen d'appliquer automatiquement un gabarit aux pages impaires (par exemple) sans devoir saisir manuellement la liste des pages 1,3,5,7,9, etc. ? Sur un document de 500 pages c'est un peu fastidieux !

Merci d'avance pour toute aide utile 🙂

Correct answer Eugene Tyson

I've attached a plain .txt file - change the extension to .jsx (no need to open)

 

In InDesign
Window>Utilities>Scripts

Right click the User folder and open that with Reveal in Finder/Explorer
- place the script in there.

 

Then run the script on any document. 

So typically you can just copy the code to any plain text editor and save it as .jsx or change the extension from .txt to .jsx. 

 

 

3 replies

jmlevy
Community Expert
Community Expert
November 7, 2025

Ton document n'est pas monté en recto-verso ?

graphozzie
Participating Frequently
November 7, 2025

Je ne suis pas sûr de bien comprendre ce que tu veux dire par "monté recto-verso". En tous cas, ma pratique habituelle est de faire la mise en page en affichant les pages en planches (en "vis-à-vis") afin de pouvoir juger à l'écran du rendu une fois le livre imprimé et relié. Puis, pour préparer le fichier à fournir à l'imprimeur (qui le demande en pages séparées), je désactive l'affichage en vis-à--vis, pour ajuster, quand il y a lieu, l'étendue des blocs allant jusqu'au bord de la page de sorte qu'ils s'étendent sur le(s) bord(s) perdu(s) concerné(s). C'est d'ailleurs un autre problème, lié à celui que j'ai posté plus haut : si on crée un gabarit de deux pages adapté à l'affichage en planches, on est coincé au moment où on repasse en affichage en pages séparées, le gabarit ne se scinde pas. J'ai donc pensé devoir conclure qu'on est obligé de créer des gabarits d'une seule page si le document est destiné à l'impression. Et donc d'affecter un gabarit aux pages paires et un autre aux pages impaires. S'il y a une solution plus simple, je suis preneur bien sûr 🙂

jmlevy
Community Expert
Community Expert
November 7, 2025

Bien compris, merci pour cette réponse très précise, cela m'évitera d'être inutilement insistant dans mes futures vérifications avec mes imprimeurs.

Merci encore pour cet échange, car si cela se confirme que je n'ai pas à fournir des fonds perdus sur l'intérieur, cela me simplifiera souvent le travail, avec le gain de temps qui correspond ! Et ce sera grâce à la possibilité que tu as donnée d'un échange long, sincère et très précis, sans lequel je serais resté sans éclaircissement utile. Bonne fin de journée et "bon vent" (comme disent les marins) pour la suite.


Bonne fin de journée et "bon vent" (comme disent les marins) pour la suite.

De même ! Et n'hésite pas à reposter si tu as d'autres questions (ou par MP si tu préfères).

Bill Silbert
Community Expert
Community Expert
November 7, 2025

This is a feature that really should be part of the program. You can log it as a feature request at https://indesign.uservoice.com/forums/601021-adobe-indesign-feature-requests

graphozzie
Participating Frequently
November 7, 2025

Good idea, thanks. As far as you know, should the request be written in English ? I'm French and tend to think there would be less risks that the request could be misunderstood if I write it in my native language... except if the request has no chance to be received by a native french speaker, and would likely be automatically translated into english. Do you have a clue about that ?

Community Expert
November 7, 2025

Ah I think you want to apply a Parent Page to all odd pages or even pages

 

This script will do the trick

// Apply selected Parent (Master) to Odd, Even, or All pages
// Works in InDesign CC and later
// by Eugene Tyson

if (app.documents.length === 0) {
    alert("Please open a document first.");
} else {
    var doc = app.activeDocument;
    var masters = doc.masterSpreads;

    if (masters.length === 0) {
        alert("This document has no parent/master pages.");
    } else {
        // Build list of master names
        var masterNames = [];
        for (var i = 0; i < masters.length; i++) {
            masterNames.push(masters[i].name);
        }

        // --- Build dialog ---
        var w = new Window("dialog", "Apply Parent to Pages");
        w.orientation = "column";
        w.alignChildren = ["fill", "top"];
        w.spacing = 10;
        w.margins = 16;

        w.add("statictext", undefined, "Select a Parent/Master Page:");
        var dropdown = w.add("dropdownlist", undefined, masterNames);
        dropdown.selection = 0;

        w.add("statictext", undefined, "Apply to:");
        var applyGroup = w.add("group");
        applyGroup.orientation = "row";
        var optOdd = applyGroup.add("radiobutton", undefined, "Odd pages");
        var optEven = applyGroup.add("radiobutton", undefined, "Even pages");
        var optAll = applyGroup.add("radiobutton", undefined, "All pages");
        optOdd.value = true; // default

        // Buttons
        var btnGroup = w.add("group");
        btnGroup.alignment = "right";
        var okBtn = btnGroup.add("button", undefined, "Apply", {name: "ok"});
        var cancelBtn = btnGroup.add("button", undefined, "Cancel", {name: "cancel"});

        // --- Apply logic ---
        if (w.show() === 1) {
            var selectedMasterName = dropdown.selection.text;
            var selectedMaster = doc.masterSpreads.itemByName(selectedMasterName);
            var pages = doc.pages;
            var appliedCount = 0;

            app.doScript(function() {
                for (var i = 0; i < pages.length; i++) {
                    var page = pages[i];
                    var pageNum = parseInt(page.name, 10);

                    var applyThis =
                        (optAll.value) ||
                        (optOdd.value && pageNum % 2 !== 0) ||
                        (optEven.value && pageNum % 2 === 0);

                    if (applyThis) {
                        page.appliedMaster = selectedMaster;
                        appliedCount++;
                    }
                }
            }, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Apply Parent to Pages");

            alert("Applied '" + selectedMasterName + "' to " + appliedCount + " pages.");
        }
    }
}

 

 

 

graphozzie
Participating Frequently
November 7, 2025

Thanks Eugene. I've not created any Indesign script yet, would you mind to give me some hints of how to proceed (should I copy this code in a .js file r a jsx file ? Where exactly to put the file, at the root of "Scripts>Scripts Panel" directory or elsewhere ?... and have you any other useful infos for a complete beginner ?)

Thanks in advance.

Eugene TysonCommunity ExpertCorrect answer
Community Expert
November 7, 2025

I've attached a plain .txt file - change the extension to .jsx (no need to open)

 

In InDesign
Window>Utilities>Scripts

Right click the User folder and open that with Reveal in Finder/Explorer
- place the script in there.

 

Then run the script on any document. 

So typically you can just copy the code to any plain text editor and save it as .jsx or change the extension from .txt to .jsx.