如何解决如何使用 PDFKit (Swift) 剪辑 PDFPage 之外的 PDFAnnotation 部分?
我正在使用 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 举报,一经查实,本站将立刻删除。