Search code examples
iosuiwebviewairprint

Capture print requests from a UIWebView


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.

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.


Solution

  • 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.