2 Replies Latest reply on Jun 23, 2009 2:38 PM by birr

    Copy pages between documents

    birr

      Hello there,

       

      I'm trying to compile a final .indd file based on different documents pages. To do that, i'm loading a XML file with the names of the files I need and the page I need .

       

      exemple of my XML:

       

      <files>

           <file url="firstDoc.indd" page="2" />

            <file url="secDoc.indd" page="5" />

           <file url="thirdDoc.indd" page="1" />

      </files>

       

      There is no probleme to load that XML and parse it. I can open the file and get the right page, but I don't know how can I copy these pages in a single new document.

      Is there any copy function ? or move function ? that can do that easily ?

       

      I've got a function like that for now:

       

      var myDocument = app.documents.add();

      for(var i=0;i<(xml.file.length()-1);i++){

           var address = xml.file[i].attribute("url");

           var myMod = app.open(File(idFileFolder+"/" + address), false);

           var myPage = myMod.pages[xml.file[i].attribute("page")];

       

      ....

       

           myMod.close(SaveOptions.no);

       

      }

       

       

      If someone have an advice or a part of a script, I'll be really thankfull.

       

      Cheers.

       

      Gael