2 Replies Latest reply on Feb 2, 2010 1:54 AM by Sam David

    "Page" Elements to Pages

    Sam David

      Hi All,
      I have a indesign document with xml in stucture pane. I want to add the indesign pages for every "Page" element?
      Any idea??? Thanks in advance
      Sam

        • 1. Re: "Page" Elements to Pages
          ramkumar.vp Level 3

          Hi Sam,


          Use the below code to do the same:


               var myDoc = app.activeDocument;
               var FIRSTPAGE=true;
               AddPages(myDoc);
               alert("Process Completed...");
               function AddPages(elm)
               {
                   for (var i = 0; i < elm.xmlElements.length; i++)
                   {
                       var XMLelementName=elm.xmlElements[i].markupTag.name.toString();
                       if(XMLelementName=="Page")
                       {
                           if(FIRSTPAGE==true)
                           {
                               myNFile.pages.add();
                           }
                           else
                           {
                               FIRSTPAGE = false;
                           }
                       }
                       AddPages(elm.xmlElements[i]);
                   }
               }


          I think the above script will solve your problem.

           

          Regards,

          Ramkumar .P

          • 2. Re: "Page" Elements to Pages
            Sam David Level 1

            Thanks Ram,

             

            It is working well. Sam