I am working print option in ios, So I just tried a print throw AirPrinter using WebView with following link stackoverflow
UIPrintInfo *pi = [UIPrintInfo printInfo];
pi.outputType = UIPrintInfoOutputGeneral;
pi.jobName = self.webview.request.URL.absoluteString;
pi.orientation = UIPrintInfoOrientationPortrait;
pi.duplex = UIPrintInfoDuplexLongEdge;
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
pic.printInfo = pi;
pic.showsPageRange = YES;
pic.printFormatter = self.webview.viewPrintFormatter;
[pic presentAnimated:YES completionHandler:^(UIPrintInteractionController *pic2, BOOL completed, NSError *error) {
NSLog(@"error %@",error);
}];
When I done it, Run the simulater,
It's shows the printing options like.
and I selected the printer and range ,Finally When I press I got a error as
2015-01-24 16:51:52.438 ZipTest[3342:206145] error Error Domain=UIPrintErrorDomain Code=4 "The operation couldn’t be completed. (UIPrintErrorDomain error 4.)"
why? Any one have the same problem before it...
Shall I preview my print pages, Is it possible?