Auto save PDF forms on Android
Since form elements are of a special annotation type — AnnotationType::WIDGET
— and since, by default, Nutrient auto saves changes to annotations inside PdfFragment#onStop
, this means that every time the fragment is sent to the background (e.g. when switching to another application or leaving the viewer activity) the form elements will be saved automatically. You can disable auto saving via the #autosaveEnabled
setter on the PdfConfiguration.Builder
:
// By default, auto save is enabled. val config = PdfConfiguration.Builder() .autosaveEnabled(false) .build() val fragment = PdfFragment.newInstance(documentUri, config) ...
// By default, auto save is enabled. final PdfConfiguration config = new PdfConfiguration.Builder() .autosaveEnabled(false) .build(); final PdfFragment fragment = PdfFragment.newInstance(documentUri, config); ...
If you’re using the PdfActivity
, you can also deactivate auto save via the #autosaveEnabled
setter of the PdfActivityConfiguration.Builder
:
// By default, auto save is enabled. val config = PdfActivityConfiguration.Builder(context) .autosaveEnabled(false) .build() PdfActivity.showDocument(context, documentUri, config) ...
// By default, auto save is enabled. final PdfActivityConfiguration config = new PdfActivityConfiguration.Builder(context) .autosaveEnabled(false) .build(); PdfActivity.showDocument(context, documentUri, config); ...
Manual form saving
Because form elements are a special annotation type, to manually save a modified form, refer to the part of our guides about modifying and saving annotations.