comet.CBook¶
- class comet.CBook¶
CBook represents an opened InDesign® book.
See also
- Module
book
Book access and queries
Methods¶
- CBook.isValid()¶
Determine whether the book is valid and open
- Returns:
Whether the book is valid and open
- Return type:
- Available:
InDesign®
- CScript:
- CBook.getPath()¶
Determine the full path to the book
- Returns:
The full path to the book
- Return type:
- Raises:
On internal error
When the book is not open
- Available:
InDesign®
- CScript:
- CBook.getDocuments()¶
Get a list of the full path to each document in the book
- Returns:
List of full pathes to each document in the book
- Return type:
- Raises:
On internal error
When the book is not open
- Available:
InDesign®
- CScript:
- CBook.save()¶
Save the book.
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
On internal error
When the book is not open
- Available:
InDesign®
- CScript:
- CBook.close(save=True)¶
Close the book.
- CBook.setCurrent()¶
Set the book as the current one
- Return type:
None
- Raises:
On internal error
When the book is not open
- Available:
InDesign®
- See also:
- CScript:
- CBook.insertDocument(document, index=-1, repaginate=True, updateCrossRefs=False)¶
Insert a document into a book. The book must be open. If the document is already in the book, the call is ignored.
- Parameters:
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
ValueError – When parameter document is of type
str
and is emptyFileNotFoundError – When parameter document is of type
str
and points to a file that does not existOn internal error
When the book is not open
- Available:
InDesign®
- CScript:
- CBook.removeDocument(document, repaginate=True, updateCrossRefs=False)¶
Remove a document from the book.
If the document is not in the book, the call is ignored.
- Parameters:
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
ValueError – When parameter document is of type
str
and is emptyIndexError – When parameter document is of type
int
and is out of boundsOn internal error
When the book is not open
- Available:
InDesign®
- CScript:
- CBook.getDocumentPosition(document)¶
Find the index of a document in the book
- Parameters:
The document to find.
The parameter type can be:
- Raises:
TypeError – When parameter types are invalid
ValueError – When parameter document is of type
str
and is emptyKeyError – When the document is not in the book
On internal error
When the book is not open
- Returns:
The index of the document in the book
- Return type:
- Available:
InDesign®
- CScript:
- CBook.setDocumentPosition(document, index, repaginate=True, updateCrossRefs=False)¶
Move a document inside the book to a new index
- Parameters:
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
ValueError – When parameter document is of type
str
and is emptyIndexError – When parameter document is of type
int
and is out of boundsKeyError – When parameter document is of type
str
orCDocument
and is not part of the bookOn internal error
When the book is not open
- Available:
InDesign®
- CScript:
- CBook.getDocumentPageRange(document)¶
Determine the page range of a document of the book.
The result page range is 0-based
- Parameters:
document (str | int | CDocument) –
The document to determine the page range for.
The parameter type can be:
- Returns:
The page range of the document as [start, end].
The values are 0-based.
- Return type:
- Raises:
TypeError – When parameter types are invalid
ValueError – When parameter document is of type
str
and is emptyIndexError – When parameter document is of type
int
and is out of boundsKeyError – When parameter document is of type
str
orCDocument
and is not part of the bookOn internal error
When the book is not open
- Available:
InDesign®
- CBook.getMasterDocument()¶
Get the master document of the book
- Returns:
Full path to the book’s master document
- Return type:
- Raises:
On internal error
When the book is not open
- Available:
InDesign®
- CScript:
- CBook.setMasterDocument(document)¶
Set the master document of the book
- Parameters:
document –
The new master document
The parameter type can be:
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
ValueError – When parameter document is of type
str
and is emptyIndexError – When parameter document is of type
int
and is out of boundsKeyError – When parameter document is of type
str
orCDocument
and is not part of the book
- Available:
InDesign®
- CScript:
- CBook.repaginate(updateCrossRefs=False)¶
Recalculate page numbers in the book