iosswiftapple-pdfkit

PDFKit / PDFView Disable Interaction with Form Annotation


For a PDFDocument that contains annotations with a widgetFieldType of PDFAnnotationWidgetSubtype.text and PDFAnnotationWidgetSubtype.button is it possible to disable user interaction for those annotations (i.e. clicking on a checkbox does not cause it to toggle)?


Solution

  • You can try this (for first page):

            pdfView.document?.page(at: 0)?.annotations.filter {
                $0.widgetFieldType == PDFAnnotationWidgetSubtype.button
                }.forEach {
                    $0.shouldDisplay = false
                }
            }