我正在使用 swift,我需要打印在 UIWebView 中打开的工作表。
let url = webView.request?.url
let stringurl = url?.absoluteString
let pic = UIPrintInteractionController.shared
let printInfo : UIPrintInfo = UIPrintInfo(dictionary: nil)
printInfo.outputType = UIPrintInfoOutputType.general
printInfo.jobName = stringurl!
pic.printInfo = printInfo
pic.printFormatter = webView.viewPrintFormatter()
pic.showsPageRange = false
pic.present(animated: true, completionHandler: nil)