1

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.enter image description here

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?

Community
  • 1
  • 1
nisar
  • 1,055
  • 2
  • 11
  • 26
  • It might be a network issue: some networks [block bonjour](http://h30434.www3.hp.com/t5/ePrint-Print-Apps-Mobile-Printing-and-ePrintCenter/hp1606-dn-UIPrintErrorDomain-error-code-4/td-p/3550541). Setting a [static IP address for the printer](http://h30434.www3.hp.com/t5/ePrint-Print-Apps-Mobile-Printing-and-ePrintCenter/Laserjet-p1102w-and-iPad-wont-print-gives-UIPrintErrorDomain/td-p/2943365) might help. – Jeffery Thomas Jan 24 '15 at 12:35

0 Answers0