exportDocumentJsonBlocking

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

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 is performed on the current thread. Avoid calling this method on the main thread and consider using exportDocumentJson instead to avoid that your application becomes unresponsive.

The method will throw a DocumentJsonFormatterException when encountering an unexpected error while exporting the JSON.

Exporting of compound documents changes 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.

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