问题描述
我无法将屏幕外内容呈现到pdf页面,有人可以在这里解释缺失或不正确的地方
func renderPDF() {
let containerView = waiverViews.containerView
let pageDimensions = containerView.bounds
let pageSize = CGRect(x: 0,y: 0,width: 612,height: 792)
let pageCount = Int(ceilf(Float(pageDimensions.height / pageSize.height)))
let outputData = NSMutableData()
let pageRect = CGRect(x: 0,y: 20,height: pageDimensions.height / 6)
UIGraphicsBeginPDFContextToData(outputData,.zero,nil)
if let context = UIGraphicsGetCurrentContext() {
for i in 0...pageCount {
let offset = CGFloat(i) * pageRect.width
UIGraphicsBeginPDFPage()
context.saveGState()
context.translateBy(x: 0,y: -offset)
context.scaleBy(x: 0.56,y: 0.56)
containerView.layer.render(in: context)
context.restoreGState()
}
}
UIGraphicsEndPDFContext()
savePdf(data: outputData)
}
SavePDf是一种保存到文档的方法
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)