Pdf form field modified callback

Product: Pdftron Android native SDK

Product Version:9.2.0

Please give a brief summary of your issue: I need a callback on modifying the pdf form field.
(Think of this as an email subject)

Basically, we need to identify whether mandatory fields are filled or not by the user?

In ios we found PTToolManagerFormFieldDataModifiedNotification Constant Reference
need similar for android.

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)

Please provide a link to a minimal sample where the issue is reproducible:

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:



Please see example Kotlin code below for our AnnotationModificationListener

class MyAnnotationModifiedListener: ToolManager.AnnotationModificationListener{
    override fun onAnnotationsModified(annots: MutableMap<Annot, Int>?, extra: Bundle?) {
        annots?.forEach { mapEntry ->
            val annotation = mapEntry.key
            if(annotation != null && annotation.isValid){
                if(annotation.type == Annot.e_Widget) {
                    val widget = Widget(annotation)
                    val field = widget.field
//todo check filled state
val annotationModifiedListener = MyAnnotationModifiedListener()
val toolManger = mPdfViewCtrlTabHostFragment.currentPdfViewCtrlFragment.toolManager

Best Regards,

thanks for the reply. This is useful to get the callback for the edited form field.

Also, suggest how to identify if all the mandatory form fields are filled or not by the user?
We need to enable submit button only on filling the mandatory fields.

Could you tell us what kind of form fields you would like to check? How are you determining which form fields are mandatory (I assume the mandatory fields will have a predetermined name)?

For example, you can call the following to check whether text fields are filled out:

    private fun checkFields(pdfViewCtrlTabHostFragment: PdfViewCtrlTabHostFragment2) {
        val pdfViewCtrl: PDFViewCtrl = pdfViewCtrlTabHostFragment.currentPdfViewCtrlFragment.pdfViewCtrl
        val doc = pdfViewCtrl.doc
        var shouldUnlock = false
        try {
            shouldUnlock = true
            val fieldIterator = doc.fieldIterator
            while (fieldIterator.hasNext()) {
                val field = fieldIterator.next()
                if (field != null) {
                    // Assuming the mandatory field has a predetermined name, you can check the field name
                    if (field.name != null && field.name == "mandatoryFieldName") {
                        val type = field.type
                        when (type) {
                            Field.e_text -> {
                                val value = field.valueAsString
                                if (!Utils.isNullOrEmpty(value)) {
                                    // Text field is filled
                                    // ...
                            // Handle other field types...
        } catch (e: PDFNetException) {
            if (shouldUnlock) {