PDFAnnotationWidgetSubtype signature swift

I am using PDFKit to render PDF & form filling. I saw the video on WWDC 2017 for PDFkit. Using annotation is explained clearly there. But I want to use PDFAnnotationWidgetSubtype signature in my application. I am not able to get the expected output. I am attaching the code :

 

func addSignature() {

 

let bounds = CGRect(x: 100, y: 100, width: 300, height: 50)

let annotation = PDFAnnotation(bounds: bounds, forType: PDFAnnotationSubtype.widget, withProperties: nil)

annotation.backgroundColor = UIColor.blue

annotation.color = UIColor.darkGray

annotation.fieldName = “signature”

annotation.widgetFieldType = .signature

annotation.caption = “WORK”

annotation.shouldDisplay = true

annotation.shouldPrint = true

annotation.widgetControlType = .unknownControl

let border = PDFBorder() border.lineWidth = 2.0

annotation.border = border

print(“Appareance Stream (annotation.hasAppearanceStream)”)

pdfView.document?.page(at: 0)?.addAnnotation(annotation)


}

This code just makes a box of given dimensions and do not detect apple pencil/hand touch gesture to take signature. Do let me know if I am missing anything here.

Powered by WPeMatico

About

You may also like...

Comments are closed.