views:

28

answers:

1

Hi, We have an Air and Flash application that opens a pdf, but many computers by default open pdfs in browser plugins rather than through reader itself. Is there a way to force the alternate behavior in Flash/Air?

This is needed since we have slightly writable pdfs.

Thanks!

A: 

I up-voted your question because I have a very similar issue (only I want to open Acrobat Reader full, instead of the plug-in, from a normal webpage and not an Air app). However, after researching (Googling) it a ton, I've become convinced that there is no way (for either of us).

The problem is that the browser essentially just does a simple MIME-type lookup to determine "I should open this in the Reader plug-in". As a result, there doesn't seem to be anything a given web page/air app can do to make the browser use a different app; the only way to change things is for the user to edit their browser preferences. The only thing that might work is if you changed the MIME type of the file being served ... but then that would just prompt the user to pick a program; it wouldn't automatically open in the standalone reader.

Anyhow, I'd love to see someone else post an answer proving me wrong, but after spending several hours on this I'm afraid we're both probably out of luck.

machineghost
I may have discovered a slightly sneaky way of dealing with it, at least in air. The plan being to change the file type to something like .pdf2 and then associating it with adobe reader rather than web browsers. That should work in air, I do not think it will work on the web though...
Parris
That should work; it's similar to my suggestion on changing the MIME type of the file being served. Either way though, this will require all of your users to individually set "Adobe Reader (Full)" as the default program for opening "pdf2" files, right? Unless air has some way of setting file-opening-preferences? If not, that seems like a non-trivial hassle for users ...
machineghost
True, hmm. i dont understand why even with air it tries to use the browser to open things. The MIME type thing should work is actually a more appropriate solution, but you have no way of setting what program it opens like you said. In air you can do that following: http://www.senocular.com/flash/tutorials/fileassociation/ not sure if you can do it in flash as well. It seems like an operation restricted to having the flex sdk. As mentioned, it may not be possible to prevent AIR or Flash from first asking the browser about a file type.
Parris
Ah, I see. So if you associate "pdf2" (or whatever) with your AIR app, you can then have your app redirect it to the "real" Adobe Reader? If so I might need to make an AIR app solely for the purpose of providing that redirection :-)
machineghost
I have no idea. I am crossing my fingers haha.
Parris