我正在尝试从 WKWebView 打印。网页和图像工作正常。
只有当我打印 PDF 文件时,页面都是空白的。
这是我用来创建 printController 的代码:
let printController = UIPrintInteractionController.sharedPrintController()
let printInfo = UIPrintInfo(dictionary:nil)
printInfo.outputType = UIPrintInfoOutputType.General
printInfo.jobName = urlField.text!
printInfo.duplex = UIPrintInfoDuplex.LongEdge
let formatter: UIViewPrintFormatter = webView.viewPrintFormatter()
formatter.contentInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
printController.printFormatter = formatter
printController.printInfo = printInfo
printController.showsPageRange = true
printController.showsNumberOfCopies = true
printController.presentFromBarButtonItem(printButton, animated: true, completionHandler: nil)
有人可以帮助我走向正确的方向吗?这个问题有解决方案吗?