importDocumentJson

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

Imports a document JSON and applies its changes to the given document. The JSON has to be provided by the given dataProvider. Deserialization is performed on the current thread. When trying to import from the main thread, consider using importDocumentJsonAsync instead to avoid that your application becomes unresponsive.

The method will throw 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).

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.