exportDocumentJsonAsync

fun exportDocumentJsonAsync(document: PdfDocument, outputStream: OutputStream, instantJsonVersion: InstantJsonVersion = InstantJsonVersion.entries.last()): Completable

Deprecated

Use the suspend exportDocumentJson API instead.

Replace with

DocumentJsonFormatter.exportDocumentJson(document, outputStream, instantJsonVersion)

Asynchronously exports all (unsaved) changes to annotations, and form elements made since opening the given document into a JSON string. This JSON string contains a pdfId and can only be imported on the exact same document again. Trying to import it in a different document will throw a DocumentJsonFormatterException. One possible use case for document JSON is syncing document changes without having to send the entire PDF.

The generated JSON is written to outputStream. Serialization 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 serialization process on a background thread, consider calling Completable.subscribeOn on the completable before subscribing.

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

Exporting of 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).

Uses the latest Instant JSON protocol version. See exportDocumentJson with InstantJsonVersion parameter to specify the version for compatibility with older clients.

Return

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

Parameters

document

The PdfDocument to serialize. This must not be a compound document.

outputStream

The OutputStream to which the JSON should be written.

See also