0 Replies Latest reply on Sep 28, 2011 6:06 AM by Clayton_George

    BookContents.Add() gets really slow after a few documents

    Clayton_George

      Hi All,

       

      I am trying to combine all the documents inside a list of books into a single book then export it as a single pdf. I'm currently using the c# code:

       

      var tempBook = _myInDesign.Books.Add(Path.Combine(_inddPath, "temp.indb"));

      tempBook.AutomaticPagination = false;

       

       

      foreach (var indbBookFilename in dirInfo)

      {

                var indbBook = ((Book)_myInDesign.Open(indbBookFilename));

       

                for (var index = 1; index < indbBook.BookContents.Count + 1; index++)

                {

                          var documentName = ((BookContent) indbBook.BookContents[index]).FullName;

       

                          tempBook.BookContents.Add(documentName);

                }

       

       

                indbBook.Close();

      }

       

       

      tempBook.Repaginate();

      ExportPdf(tempBook, tempBook.FullName.Replace(".indb", ".pdf"));

       

      tempBook.BookContents.Add(documentName) takes about 1-2 seconds the first time then continuesly increases until it takes a few minutes to add a single document. The current list of Books I'm using has about 60 chapters but some can have up to 150. At the 60th chapter it takes about 15 minutes to add a single document is there somthing i can turn off to make this quicker

       

      Thanks for any help or insights,

       

      Clayton