从UIWebView捕获打印请求 [英] Capture print requests from a UIWebView

查看:84
本文介绍了从UIWebView捕获打印请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,可以包装网站。它允许我们将第三方Web应用程序用于我们业务中的某些服务。它将要做的一件事是打印标签。在移动safari中,如果我进行设置并按print,则该请求将在safari中处理,并且使用空中打印我可以毫无问题地进行打印。

I have an app that is a wrapper for a website. It allows us to use a third party web app for some services in our business. One of the things it will do is print labels. In mobile safari if I do the setup and press print, the request is processed in safari and I can print without any issue using air print.

在我的自定义应用程序中,uiwebview发出相同的请求,但是没有任何内容发送到打印机。我添加了一个弹出框,可以手动提交打印作业,但无法捕获来自Web视图的任何打印请求。

Inside of my custom app the uiwebview makes the same request however nothing is sent to the printer. I have added a popover that I can manually submit a print job, but I can't manage to capture any print requests that come from the webview.

推荐答案

我能够与一位Apple工程师联系,该工程师确认无法从 UIWebView接收 window.print 请求。就我的目的而言,我只是使用javascript将 window.print 函数更改为一个命令,该命令将告诉我发出了打印请求,然后可以打印出部分内容。我需要的网络视图。

I was able to get in touch with an Apple engineer who confirmed it is impossible to receive the window.print request from UIWebView. For my purposes, I just use javascript to change the window.print function to a command that will tell me the print request was made, and then I can print the part of the webview that I needed.

这篇关于从UIWebView捕获打印请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆