static void ExportDocs(int c, List<BookContent> contents, PDFExportPreset preset) { BookContent[] arr = new BookContent[contents.Count]; Objects bc = application.CreateCollection( book.BookContents); //BookContents bc = new BookContents(); for (int i = bc.Count; i > 0; i--) { if (! contents.Contains((BookContent) bc[i]) ) bc.Remove(i); } //for (int i = 0; i < contents.Count; i++) // bc.Add(contents[i],i); //arr[i] = contents[i]; //if (bc.Count == 1) // bc.Add(null,1); if (bc.Count > 0) { string name = book.Name.Replace(".indb", "." + c + ".pdf"); Console.WriteLine("Exporting " + name + " to pdf"); // TODO - fix book.Export(idExportFormat.idPDFType, basePath + name, false, preset, bc, miss, false); } }