File Operations#

There are a number of file operations available against a document, an application developer should only be required to implement these if using the Custom UI.

Save#

Saving a document only needs to be invoked if there are changes made to a document. As such an application developer can verify if changes have been made or not and act accordingly.

if (documentView.isDocumentModified {
    documentView.save()
}

Save As#

When saving a document using this method an application developer must provide a valid path on the file system to save to.

val docPath:String = "<YOUR_DOCUMENT_PATH>"

documentView.saveTo(docPath) { result, err ->
    if (result == SODocSaveListener.SODocSave_Succeeded) {
        // success
    } else {
        // error
    }
}

Export#

It is possible to export the content of a PDF into an external text file for simple text extraction. To do so an application developer should define a valid file path to use with the exportToAPI.

documentView.exportTo("filePath", "txt") { result, err ->
    if (result == SODocSaveListener.SODocSave_Succeeded) {
        // success
    } else {
        // error
    }
}

Note

At present the only valid format to export to is a text file, so the format parameter should always be set to “txt”.

Further formats will become available later.

Print#

Application developers should call the print() method against the DocumentView instance to open up the print dialog.

documentView.print()