解决方法@H_403_10@
UIPrintInfo *pi = [UIPrintInfo printInfo];
pi.outputType = UIPrintInfoOutputGeneral;
pi.jobName = webView.request.URL.absoluteString;
pi.orientation = UIPrintInfoOrientationPortrait;
pi.duplex = UIPrintInfoDuplexLongEdge;
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
pic.printInfo = pi;
pic.showsPageRange = YES;
pic.printFormatter = webView.viewPrintFormatter;
[pic presentAnimated:YES completionHandler:^(UIPrintInteractionController *pic2,BOOL completed,NSError *error) {
// indicate done or error
}];
Apple的开发网站上有一个更广泛的sample.
UIPrintInfo *pi = [UIPrintInfo printInfo]; pi.outputType = UIPrintInfoOutputGeneral; pi.jobName = webView.request.URL.absoluteString; pi.orientation = UIPrintInfoOrientationPortrait; pi.duplex = UIPrintInfoDuplexLongEdge; UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController]; pic.printInfo = pi; pic.showsPageRange = YES; pic.printFormatter = webView.viewPrintFormatter; [pic presentAnimated:YES completionHandler:^(UIPrintInteractionController *pic2,BOOL completed,NSError *error) { // indicate done or error }];
Apple的开发网站上有一个更广泛的sample.