Open file after saving to local in flex web application - actionscript-3

I have web application in which there datgrid inside there on last column there is pdf icon. On click of that i get pdf file byte array.
Now, i want to open that pdf in pdf reader/viewer at client side.
For that i have downloaded it as pdf like:
var fR:FileReference = new FileReference();
fR.save(byteArray,"test.pdf");
But, i can't open that pdf in inside viewer. I have searched lots of things but didn't get any solution for that.
My aim is to open pdf file at client side from bytearray which got in response.
Any help would be greatly appreciated.

But, i can't open that pdf in inside viewer.
I'm glad you can't. Otherwise, every flash file that's running on a website could start applications on my computer and wreak havoc.
Your intentions may be good, but those of others aren't. That's why security policies and sandboxes are in place.
If you want that kind of access to a client computer, you should build a desktop application with Air.

In the Flash Player you can't open the PDF from a ByteArray response. What you can do is have your server respond with an actual PDF document and navigate the user's browser to the PDF URL using navigateToURL(). This is up to the client's browser, but in many cases the browser will allow the user to view the PDF or open the PDF in a viewer app.

Related

Auto-Convert OneNote to PDF

I am trying to automatically convert some Microsoft OneNote files to PDF to send as a daily email attachment. I have thought of two systematic solutions but need some help in finding the right tools:
Find an application that may be programmatically called (via a Python script e.g.) that will convert a Microsoft OneNote file to a PDF.
Find a way for OneNote to automatically save files as PDFs every time it auto-saves.
Is anyone aware of tools available for either solution?
See my answer to your other question
The approach would be to get the pages content with
./me/onenote/pages/1-1c13bcbae2fdd747a95b3e5386caddf1!1-xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx/content?includeIDs=true&includeInkML=true&preAuthenticated=true
and then render the html on a canvas with javascript/jquery.
render ink with InkMLjs
and then use a library to convert the canvas to a pdf for example with canvas2pdf
Another approach might be something like Automator for osx. You could get the pages of interest with the microsoft-graph api, open them in a web browser using applescript and when the page has finished rendering -> print -> "Save as PDF"

HTML5 application Cache for pdf files, for static single page app

I have a single page application and I created a main.appache file which is referred to HTML using
the main.appache has a pdf links. When loading the page will the pdf file be cached automatically?
As I have to first be online and open the pdf file then when I go offline I am able to view it. But is there a way we can do it while loading the single page application without going online to retrieve the pdf file.
When loading the page will the pdf file be cached automatically?
Yes, anything included in the manifest will be downloaded the first time a page that references the manifest is loaded.
But is there a way we can do it while loading the single page application without going online to retrieve the pdf file.
No, you're always going to have to be online to retrieve the PDF for the first time. Subsequent visits will use the cached version.

Abobe Air/Flex 4.6 Remote File Viewer

I have a Air/Flex desktop application and I'm trying to create a component within the app that can view files on the web server is is already connected to. It just needs to access one particular folder that will contain PDFs, Images & Word documents. I also want the ability to click on the files and having them open in their default desktop applications.
Is this possible and how would I go about doing this?
It's possible but not with your Flex/AIR app alone. It cannot view files/directories on server by itself but it can communicate with your server via webservices, AMF, or any other back end based service. Typically the back end reads the folder and send this information to your app. Your app can open those files in corresponding app but only if those files are available on disk so your app will have to download them prior to opening them.
Every Application has different needs but I myself usually save anything to a desktop or you can use the App storage container as well. As I use only the desktop I download what is needed OR been asked for, and the visitor has the choice of keeping it or if not needed it gets automatically deleted! this way you can use whatever PDFs, Word, Images etc. use read and write (re-write) as well as creating PDFs on the fly with Images, text etc, and that way a visitor also can print directly at his or her own leisure. regards aktell

How HTML file upload works?

HTML uses form to send data to web server. The data can be included in the url parameters or embedded in HTML Request body. But for a file, I don't know how it works. I want to know this because I see some difference between uploading file on web and desktop applications.
The desktop application usually provides a text box to allow the user input the locale path of the file. But for web applications, the text box is usually read only.It displays the file path when the file gets selected with the browse button. Is that just a design issue between desktop and web?
Question is a bit unclear, but one important aspect about web applications (or HTML forms) is that they are sandboxed and cannot access local files directly. So the file upload picker does not allow direct input of the file name (which might be scripted), but only selection through an OS (or browser) supplied file choose UI (that the app or page cannot mess with).
Once the user has selected the file the page can access it, but it cannot make the selection itself (or surreptitiously).
A recent trend is to lock down desktop apps in the same manner. See for example Apple's sandboxing restrictions, that also do not allow apps to open random files without user intervention.
Is that just a design issue between desktop and web?
The implementation of a file upload form, whether desktop or web, is largely unimportant to the end result. Both desktop and web controls can utilize either a path string or a full-blown file navigator, though a desktop app is more likely to vary in its implementation. The only other difference is the destination: desktop apps tend to parse the file in memory and render it somehow, while web apps almost invariably upload it to a server (though this is subject to change: see the HTML5 file API), which then further operates on it.

How to preview other content types in titanium desktop

I am using titanium to build a desktop application. They are a couple of times I need to download an excel file (or any other content type).
I am expecting it to open a file chooser dialog so I choose a folder to save it in. Instead it displays the content of the excel file in the desktop window which is not very useful.
I am able to view PDF files correctly in the desktop window.
How do I download regular files from titanium.
I may be wrong here, but I don't think you can control this behavior. This is based on each client machine that is using your application and their specific settings. Maybe this forum will help.
It may also depend on the content headers of the source of your file. If you need a reference for how a web application can be configured to force a download, see here. While this is based on a web app, the same MIME type rules apply.