Unable to display printer options with AirPrint

2019-05-25 21:37发布

I want to add AirPrint functionality to my iPad application

I have been trying to display printer ontions described in Apple's Drawing and Printing Guide

I have toolbar and UIBarButtonItem *printButton. In controller I receive onPrintClick and try to display printer options by such code:

UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController];
 [controller setDelegate:self];
 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
  [controller presentFromBarButtonItem:self.printButton animated:YES
         completionHandler:completionHandler];
 } else {
  [controller presentAnimated:YES completionHandler:nil];
 }

Please help, because I do receive nothing :(

3条回答
Juvenile、少年°
2楼-- · 2019-05-25 21:53

You need to set printItem/printItems property in order to use an AirPrint.

controller.printItem = a URL to PDF or image file;
查看更多
放荡不羁爱自由
3楼-- · 2019-05-25 22:07

There is this similar question: How to print in iOS 4.2?

Try with this. It really helped me in adding Air Print to my app.

查看更多
Luminary・发光体
4楼-- · 2019-05-25 22:07

I've used this personally on an iPad app: Including AirPrint on an iOS App

查看更多
登录 后发表回答