问题描述
我正在使用 PDFKit (Swift) 向 PDF 当前页面添加一个简单的 PDFAnnotion(Ink)。问题是当我在注释的某些部分位于页面边界之外的位置添加注释时,注释的部分不会被剪裁并显示在页面之外。我怎样才能摆脱注释的这个外部部分?我也附上了一张图片。这是代码
private func createFinalAnnotation(path: UIBezierPath,page: PDFPage) -> PDFAnnotation {
let border = PDFBorder()
border.lineWidth = drawingTool.width
let bounds = CGRect(x: path.bounds.origin.x - 5,y: path.bounds.origin.y - 5,width: path.bounds.size.width + 10,height: path.bounds.size.height + 10)
var signingPathCentered = UIBezierPath()
signingPathCentered.cgPath = path.cgPath
signingPathCentered.moveCenter(to: bounds.center)
let annotation = PDFAnnotation(bounds: bounds,forType: .ink,withProperties: nil)
annotation.color = color.withAlphaComponent(drawingTool.alpha)
annotation.border = border
annotation.add(signingPathCentered)
page.addAnnotation(annotation)
return annotation
}
我正在使用此策略添加墨迹注释:Medium iOS PDF Ink Annotation
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)