0
在我的项目还有一点是我们打印与下面的代码一个简单的PDF文件打印选项:访问无线网络打印机
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
if (pic && [UIPrintInteractionController canPrintData: self.myPDFData]) {
pic.delegate = self;
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
printInfo.jobName = @"PrintPdf";
printInfo.duplex = UIPrintInfoDuplexLongEdge;
pic.printInfo = printInfo;
pic.showsPageRange = YES;
pic.printingItem = self.myPDFData;
void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) =
^(UIPrintInteractionController *pic, BOOL completed, NSError *error) {
if (!completed && error)
NSLog(@"FAILED! due to error in domain %@ with error code %ld",
error.domain, (long)error.code);
};
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[pic presentFromRect:self.printButton.frame inView:self.view animated:YES completionHandler:^(UIPrintInteractionController *printInteractionController, BOOL completed, NSError *error) {
}];
} else {
[pic presentAnimated:YES completionHandler:completionHandler];
}
}
它工作正常,当我做了测试打印机模拟器。我的要求是打印机可能在同一个wifi的另一个子网上。我如何完成这项工作?
只想告知IP地址是:192.168.1.100,打印机IP地址是:192.168.2.101,两者在同一网络但子网不同。我看到我的iPad应用程序无法找到打印机。请建议。 –