create Content Position Timeline
Creates a new ContentPositionTimeline using the specified list of ReaderDocuments. A ContentPositionTimeline is used for describing positions in ReaderPublication content as integers. The timeline starts at position 0 and its length can be retrieved using ContentPositionTimeline.length.
Choosing unit of measure
The ContentPositionTimeline can be configured with different unit of measures. At this moment, CHARACTERS are not available as a unit of measure for PDFs. By default, PAGES will be used as unit of measure.
PAGES
The timeline is created by counting all pages in the provided list of ReaderDocuments. Each position in the timeline points to the start of a page.
DOCUMENTS
The timeline is created by counting all provided ReaderDocuments.
Specifying the list of ReaderDocuments
The passed list of ReaderDocuments is validated according to the following rules:
The list must not be empty
All ReaderDocuments must belong to this publication.
All ReaderDocuments must be ordered as in the publication spine.
If the passed list of readerDocuments fails validation, the returned Promise will be rejected with an error.
Some examples:
const spine = readerPublication.getSpine();
readerPublication.createContentPositionTimeline(spine); // OK!
readerPublication.createContentPositionTimeline(spine.slice(1, 4)) // OK!
readerPublication.createContentPositionTimeline(spine.filter(item => item.isReflowable()); // OK!
readerPublication.createContentPositionTimeline(spine.reverse()); // ERROR!
Parameters
The reader documents that should be part of the timeline.
Called with the new ContentPositionTimeline object if the operation is successful.
Called if an error occurred while creating the timeline.
A function called several times indicating the create progress as a value between 0 and 1.
Creates a new ContentPositionTimeline using the specified list of ReaderDocuments. A ContentPositionTimeline is used for describing positions in ReaderPublication content as integers. The timeline starts at position 0 and its length can be retrieved using ContentPositionTimeline.length.
Choosing unit of measure
The ContentPositionTimeline can be configured with different unit of measures. At this moment, CHARACTERS are not available as a unit of measure for PDFs. By default, PAGES will be used as unit of measure.
PAGES
The timeline is created by counting all pages in the provided list of ReaderDocuments. Each position in the timeline points to the start of a page.
DOCUMENTS
The timeline is created by counting all provided ReaderDocuments.
Specifying the list of ReaderDocuments
The passed list of ReaderDocuments is validated according to the following rules:
The list must not be empty
All ReaderDocuments must belong to this publication.
All ReaderDocuments must be ordered as in the publication spine.
If the passed list of readerDocuments fails validation, the returned Promise will be rejected with an error.
Some examples:
const spine = readerPublication.getSpine();
readerPublication.createContentPositionTimeline(spine); // OK!
readerPublication.createContentPositionTimeline(spine.slice(1, 4)) // OK!
readerPublication.createContentPositionTimeline(spine.filter(item => item.isReflowable()); // OK!
readerPublication.createContentPositionTimeline(spine.reverse()); // ERROR!
Return
Either ColibrioResult.Success with the new ContentPositionTimeline object if the operation is successful, or ColibrioResult.Error if an error occurred while creating the timeline.
Parameters
The reader documents that should be part of the timeline.
A function called several times indicating the create progress as a value between 0 and 1.