Skip to content
Guides

End Content Editing and Save

After completing edits, you can exit editing mode by using endEdit with CPDFReaderView to switch out of edit mode. To save the changes, utilize either save() or saveAs() save the modified document.

java
// Exit edit mode
CPDFEditManager editManager = readerView.getEditManager();
if(editManager.isEditMode()){
  editManager.endEdit();
}
// Exit edit mode and switch to VIEW mode.
readerView.setViewMode(CPDFReaderView.ViewMode.VIEW);
try {
  CPDFDocument document = readerView.getPDFDocument();
  if (document.hasChanges()){
    // Save changes to the local document.
    document.save();
  }
} catch (Exception e){

}
kotlin
// Exit edit mode
val editManager = readerView.editManager
if(editManager.isEditMode()){
  editManager.endEdit()
}
// Exit edit mode and switch to VIEW mode.
readerView.viewMode = CPDFReaderView.ViewMode.VIEW
try {
  val document = readerView.pdfDocument
  if (document.hasChanges()){
    // Save changes to the local document.
    document.save();
  }
} catch (e : Exception){
}