Skip to main content
Known Participant
April 1, 2015
Question

How to get Safari to open an HTML document created in AIR on iOS

  • April 1, 2015
  • 1 reply
  • 1618 views

We have an iOS app that creates a 3-page HTML document on the user's device and then prints it. We were using Darkredz ANE to do this, but the ANE is broken in iOS 8 and the Darkredz website is abandoned.

As a workaround, we want to use Safari to launch the HTML document, then print from Safari. But Safari won't open a local document that belongs to another app, probably because of the security sandbox. We don't have a network connection, so we can't save the file remotely. Is there a way to get Safari to open a local document?

If not, does anyone know of a FileManager app that can open files that are located in the "documents" folder of other apps on the device? I've tried several of them, but so far, they only load files from iCloud, Box, etc.

Thanks for any tips.

This topic has been closed for replies.

1 reply

Colin Holgate
Inspiring
April 1, 2015

Are you able to include a print button in the HTML? If you can, you could use a StageWebView to show the HTML, inside the AIR app.

Another option would be to image the pages, and use a social sharing ANE, like GoViral. The user would do a share, and could choose whether to email it, send it to Facebook, Twitter, or print it. There's probably other ANEs that are simpler than GoViral that can do basic sharing, to get those features.

A third way to solve the problem could be to upload the HTML to a server side script, and then open that page using navigateToURL(), to launch Safari.

Known Participant
April 1, 2015

Thanks, Colin -- those are 3 great ideas. I can't do #1, because StageWebView doesn't support the Javascript "print" function. I can't do #2 or #3 because I don't have a network connection.

Colin Holgate
Inspiring
April 1, 2015

How will you be printing if the device is not on a network?