importDocumentJsonAsync

open fun importDocumentJsonAsync(@NonNull document: PdfDocument, @NonNull dataProvider: DataProvider): Completable

Asynchronously imports a document JSON and applies its changes to the given document. The JSON has to be provided by the given dataProvider. Deserialization will start upon subscribing to the Completable returned by this method. The returned completable does not operate on any particular scheduler. If you want to run the deserialization process on a background thread, consider calling subscribeOn on the completable before subscribing.

The returned completable will emit a DocumentJsonFormatterException when encountering an unexpected error while importing the JSON.

Importing JSON to compound documents is not supported. This method will throw an exception if called with a compound document (i.e. a document having more than one document source).

Return

A Completable that will start the JSON import once its subscribe method is called.

Parameters

document

The PdfDocument to which the JSON should be imported. This must not be a compound document.

dataProvider

The DataProvider which serves the document JSON.

See also

Throws

if trying to import document JSON created with a different document, or other error occurs while importing.