- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我遇到的一个真正令人沮丧的事情是无法同时打印到多台 AirPrint 打印机。不要将这与在一台打印机上打印多个 ITEMS 相混淆。
例子:
我们有 3 台 AirPrint 打印机。
每台打印机都需要打印一些东西……一个接一个。
如果你已经有了你的 UIPrinter 对象,你会调用:
- (BOOL)printToPrinter:(UIPrinter *)printer
completionHandler:(UIPrintInteractionCompletionHandler)completion;
在完成方法中,正常的过程是像这样在完成方法中触发下一个作业:
- (void)printAllJobs
// let's use an example printer url:
UIPrinter *printer = [[UIPrinter alloc] initWithURL:[NSURL URLWithString:@"ipps://mycomputer.:863/printers/label"]];
// get the printer interaction controller:
UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController];
// now print:
[controller printToPrinter:printer completionHandler:^(UIPrintInteractionController * _Nonnull printInteractionController, BOOL completed, NSError * _Nullable error) {
// here.. you would check if the job is complete:
if (completed) {
// print to the next printer:
// THIS METHOD GETS FIRED BUT DOESN'T ACTUALLY PRINT
[self printToNextPrinter];
}
}
}
- (void)printToNextPrinter {
// create next printer:
UIPrinter *nextPrinter = [[UIPrinter alloc] initWithURL:[NSURL URLWithString:@"ipps://mycomputer.:863/printers/roller"]];
// get controller:
UIPrintInteractionController *controller = [UIPrintInteractionController sharedPrintController];
// print:
[controller printToPrinter:printer completionHandler:^(UIPrintInteractionController * _Nonnull printInteractionController, BOOL completed, NSError * _Nullable error) {
// this never gets executed.
}
}
最佳答案
我发现了什么:
发生这种情况时会发生一件值得注意的事情;屏幕上显示一个 UIAlertController,上面写着“Printing to.. xxx”——显示打印进度。
解决方案:
解决方案是每 2 秒检查一次,看看屏幕上是否有可见的警报。如果有,重复相同的方法,如果没有,则启动下一个打印作业。似乎 Apple 不允许在没有警报的情况下进行后台打印,所以这是唯一的方法.. 除了深入研究 CUPS 之外,这将是一团糟。
关于ios - UIPrintInteractionController 打印到多台 AirPrint 打印机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54026117/
这个问题刚刚出现在 iOS 13 中,之前不是问题。如果我展示 UIPrintInteractionController带有单个图像的 Controller ,一切正常。如果我提交多张图片,打印 Co
我正在尝试通过我的 iPad 应用程序打印从网络服务器中提取的 PDF 文档。该文档是横向的(通过预览证明),但 UiPrinterInteractionController 以纵向模式打印文档。 我
UIPrintInteractionController 语言为中文时只显示英文。 有什么建议吗? 最佳答案 在 xcode 中,选择您的项目,在项目信息选项卡中,转到 [Localizations]
我想知道是否有一种方法可以通过代码设置要打印的最小份数,因为我需要一份文档来重复打印。 我阅读了 Apple 开发者页面上的文档,但找不到任何内容。 我知道您可以从打印机对话框中设置份数,但我需要默认
我想编写一个应用程序来为 AirPrint 打印机(Brother QL-820NWB)提供打印功能。问题是,如果我在应用程序中显示 UIPrintInteractionController,则不会显
我想打印一些 PDF NSData,当我显示 UIPrintInteractionController 时PDF 显示正确,但文本和其他数据在 UITableViewCell 上的 UIPrintIn
我正在使用 UIPrintInteractionController 使用打印图像概念开发 iPhone 应用程序。我一直停留在一点,即 边框,每当我尝试使用打印机打印任何图像时,它总是在所有边上显示
当使用 UIPrintInteractionController 时, 关闭“页面范围”和“份数”选项很容易 UIPrintInteractionController *pic = [UI
我正在使用 UIPrintInteractionController 从 rect 中呈现它。 UIPrintInteractionController *controller = [UIPrintI
很直接... 现在我认为自己是一名经验丰富的 iOS 开发人员,但这似乎是 iOS 中一个明显的错误,除非我遗漏了一些东西。 请看下面的代码。 文件路径指向两个一页的 PDF。 显示的是一个没有要打印
UIPrintInteractionController (Swift) 最多可以执行多少次打印? 我目前正在为一个项目进行 AirPrint。想知道如何使用打印机模拟器进行批量打印的压力测试。 是否
我有一个以编程方式创建的 UIPrintInteractionController。它设置为从我的服务器中提取 pdf,并打印所述 pdf。我的问题是如何更改 View 的字体。我已经在我的应用程序委
编写了 UIPrintInteractionControllerDelegate 后,我希望在 printInteractionController:choosePaper: 中对其纸张选择功能进行单
我正在使用 UIPrintInteractionController presentAnimated 从 UIActionSheet 中的按钮显示打印对话框。 只要我触摸按钮,设备就会在约 10 秒内
有没有办法判断 UIPrintInteractionController 是否正在显示(可能类似于您检查弹出窗口的方式)? if ([popover isPopoverVisible]) {
我正在使用“UIPrintInteractionController”来打印一些文档。出于安全原因,不应启用其他共享选项。 但是在缩放“UIPrintInteractionController”中的内
我正在尝试像这样打印通过 NSURLConnection 下载的 pdf 文档 UIPrintInteractionController *pic = [UIPrintInteractionC
如何更改 UIPrintInteractionController 的导航栏标题(打印机选项)? 最佳答案 您可以使用 UIPrintInteractionController 的委托(delegat
苹果蓝与我的应用颜色不匹配,因此打印对话框非常不和谐。 在我的 iPhone 应用程序中,我可以使用以下 UIPrintInteractionControllerDelegate 代码获得正确的导航栏
我目前正在开发一个应用程序,通过 UIPrintInteractionController printToPrinter 方法使用直接打印,但是当我启动打印订单时,弹出窗口显示: Printing t
我是一名优秀的程序员,十分优秀!