Skip to main content
Known Participant
Apr 1, 2015 6:40 PM UTC
Question

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

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 is closed to new replies. Start a new post to keep the conversation going.

17 replies

Colin Holgate
Inspiring
Apr 1, 2015 6:51 PM UTC

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.

Translate
Known Participant
Apr 1, 2015 7:11 PM UTC

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.

Translate
Colin Holgate
Inspiring
Apr 1, 2015 7:24 PM UTC

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

Translate