I'm adding ink annotations to PDFDocument using the PDFAnnotation() class with subtype ink. The idea is to capture signatures that are drawn using touch.
Inspired by UberSignature my UIBezierPath is a series of rectangles that are supposed to be filled with a color. However, when I add the annotation to the PDFDocument it is not filled.
It seems the UIBezierPath's fill() method does nothing at all when added to a PDFAnnotation?
If I use the same UIBezierPath and draw it on an UIImage it is correctly filled with a solid color.
Any ideas on what could be wrong?
Problematic code:
UIColor.red.setStroke()
UIColor.red.setFill()
var path = UIBezierPath()
path.append(myRectangles)
path.fill()
var annotation = PDFAnnotation(bounds: path.bounds, forType: .ink, withProperties: nil)
annotation.add(path)
myPDFPage.addAnnotation(annotation)
In the screenshot I have tried to write normal text, and two example lines. The line on the left is drawn slowly, the line on the right is drawn fast. The idea is to have width of the line vary according to the speed it is drawn to make a signature look more natural/realistic.
