Highlighted

How to create/add new chapters within a book?

New Here ,
Sep 22, 2017

Copy link to clipboard

Copied

I am trying to generate a new book and create some new chapters in it, add old chapters to it, change component types, etc. Is there a method to create a new chapter in a book and can we use the same method to add old chapters to a new book? I tried creating a new object of the BookComponent class and manipulating its properties but it does not have a constructor.

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

I think the method you want is on a Book object. It is called NewSeriesBookComponent. Here is a function that takes a Book object and an Array of absolute file names and adds each component in the Array to the book. Hopefully, this will get you started.

function addFilesToBook (book, filesArray) {

  

    var i = 0, count = filesArray.length, bookComp;

    for (i = 0; i < count; i += 1) {

        bookComp = book.NewSeriesBookComponent (0);

        if (bookComp.NextComponentInBook.ObjectValid()) {

            bookComp.NextComponentInBook = 0;

        }

        bookComp.Name = filesArray.path;

    }

}

TOPICS
Scripting

Views

322

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to create/add new chapters within a book?

New Here ,
Sep 22, 2017

Copy link to clipboard

Copied

I am trying to generate a new book and create some new chapters in it, add old chapters to it, change component types, etc. Is there a method to create a new chapter in a book and can we use the same method to add old chapters to a new book? I tried creating a new object of the BookComponent class and manipulating its properties but it does not have a constructor.

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

I think the method you want is on a Book object. It is called NewSeriesBookComponent. Here is a function that takes a Book object and an Array of absolute file names and adds each component in the Array to the book. Hopefully, this will get you started.

function addFilesToBook (book, filesArray) {

  

    var i = 0, count = filesArray.length, bookComp;

    for (i = 0; i < count; i += 1) {

        bookComp = book.NewSeriesBookComponent (0);

        if (bookComp.NextComponentInBook.ObjectValid()) {

            bookComp.NextComponentInBook = 0;

        }

        bookComp.Name = filesArray.path;

    }

}

TOPICS
Scripting

Views

323

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 22, 2017 0
Adobe Community Professional ,
Sep 22, 2017

Copy link to clipboard

Copied

I think the method you want is on a Book object. It is called NewSeriesBookComponent. Here is a function that takes a Book object and an Array of absolute file names and adds each component in the Array to the book. Hopefully, this will get you started.

function addFilesToBook (book, filesArray) {

  

    var i = 0, count = filesArray.length, bookComp;

    for (i = 0; i < count; i += 1) {

        bookComp = book.NewSeriesBookComponent (0);

        if (bookComp.NextComponentInBook.ObjectValid()) {

            bookComp.NextComponentInBook = 0;

        }

        bookComp.Name = filesArray.path;

    }

}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 22, 2017 0