Reputation: 83
I can print my UIWebview content, but it prints on two pages, how can I scale it down to fit one page ?
My code:
@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)
}
Upvotes: 3
Views: 3506
Reputation: 75
From your comment:
var webView = UIWebView()
let pic = UIPrintInteractionController.sharedPrintController()
let printInfo : UIPrintInfo = UIPrintInfo(dictionary: nil)
// General: Text, Graphics and images.
// Photo: Black and white or color images.
// PhotoGrayscale: Black and white and grayscale images
// Grayscale: Gray scale general. (Black and white)
printInfo.outputType = UIPrintInfoOutputType.General
pic!.printInfo = printInfo
pic!.printFormatter = webView.viewPrintFormatter()
pic!.showsPageRange = true
The only thing missing is the closure, and you will have to develop that on your own (I am sorry!)
Upvotes: 3