open

suspend fun open(asset: Asset, credentials: String? = null, allowUserInteraction: Boolean, onCreatePublication: Publication.Builder.() -> Unit = {}, warnings: WarningLogger? = null): Try<Publication, PublicationOpener.OpenError>

Opens a Publication from the given asset.

If you are opening the publication to render it in a Navigator, you must set allowUserInteraction to true to prompt the user for its credentials when the publication is protected. However, set it to false if you just want to import the Publication without reading its content, to avoid prompting the user.

The warnings logger can be used to observe non-fatal parsing warnings, caused by publication authoring mistakes. This can be useful to warn users of potential rendering issues.

Return

A Publication or an OpenError in case of failure.

Parameters

asset

Digital medium (e.g. a file) used to access the publication.

credentials

Credentials that Content Protections can use to attempt to unlock a publication, for example a password.

allowUserInteraction

Indicates whether the user can be prompted, for example for its credentials.

onCreatePublication

Transformation which will be applied on the Publication Builder. It can be used to modify the manifest, the root container or the list of service factories of the Publication.

warnings

Logger used to broadcast non-fatal parsing warnings.