UIWebview和打印

时间:2015-01-06 11:27:16

标签: ios swift printing uiwebview

我正在尝试在我的webview中打印由本地html文件制作的内容,并将webview设置为适合屏幕,问题是我要打印webview的内容并打印在2张A4纸而不是缩小它只能打印在一张纸上,是否有人知道如何将其缩小到一页?

我的打印方法:

@IBAction func printWebPage(sender: UIBarButtonItem) 
{
  let url = MainWebView.request?.URL
  let stringurl = url?.absoluteString

  let pic = UIPrintInteractionController.sharedPrintController()
  let printInfo : UIPrintInfo = UIPrintInfo(dictionary: nil)

  printInfo.outputType = UIPrintInfoOutputType.General
  printInfo.jobName = url  

  pic!.printInfo = printInfo
  pic!.printFormatter = MainWebView.viewPrintFormatter()
  pic!.showsPageRange = false

  pic!.presentAnimated(true, completionHandler: nil)
}

0 个答案:

没有答案