Flex 3 + AlivePDF - How to display pdf in the browser - apache-flex

I'm testing alivePDF 0.1.5 and till now everything's been fine.
I'm super interested in the new function writeFlashHTMLText() cause it makes my life so much easier! xD
I'm now trying to display the generated pdf in a browser tab/window instead of just saving the file (using the filereference class' save function). I saw that there was a PDF.save() function that allowed that specifying the argument Download.INLINE.
However I don't want to use the save function of the pdf class cause I don't want to use a script.
Is there any other way to achieve what I want?
Thanks a lot for your answers.
Regards,
BS_C3

Because of the way Flash works security-wise you have two options:
Generate and save the PDF to the local machine - this can be done entirely client-side using FlashPlayer 10+ (see the FileReference class).
The user can then navigate to, and launch, the generated PDF file.
Save the PDF to a server and link to the PDF from your Flash application. This will let you open the PDF in the browser.
Obviously this requires a server of some sort.
Build your app as an AIR application - this will let you save the file and, as far as I'm aware, launch it from the local machine.
The current state of things: you cannot generate a PDF and open it in the browser completely client-side (i.e. FlashPlayer in a browser) unless you are using AIR.

Related

RadEditor ExportToPDF not generating PDF in client's environment

We are using the Telerik RadEditor control, specifically for it's ability to render a PDF via the ExportToPDF() method on the control. We find that this works great in our development and test environments but fails as soon as we get to our client's environment. What I mean by fails is that typically when you execute the ExportToPDF() method, a dialog box pops up with the name of the PDF file, it's size, and whether you want to open it or save it. In our client's environment that dialog window appears, but the file size does not appear. If you save the file, it's a blank document. The machines / environments are equal in their setup (IIS 6 on Windows server 2003). The only exception is that our client's machine is in a secure environment with no access to the internet.
We are loading form letters into the control and then creating the PDF once the user clicks a button, so I don't think this is being caused by bad data / invalid characters causing the PDF not to generate.
My questions are: does anyone have experience running the ExportToPDF() command in an environment with no access to the internet? Could this be a permissions issue? I can't seem to find documentation on whether the ExportToPDF() functionality uses a temporary directory to write the PDF out to while it's rendering. It may be as simple as that, but I'm having a hard time researching this issue.
I've also put a try / catch block around the ExportToPDF() method and I know it's not throwing any errors.
We are running an older version of RadEditor - 2009.3.1208 - it runs in a large application with other Telerik tools so upgrading the entire RadControl suite is not trivial (b/c of testing, etc) and is taking some time.
Any suggestions on what to try next / has anyone encountered anything like this with this control?
Thanks for your help in advance!
Richard
I doubt that the export functionality needs an active internet connection. Most likely something in your secured environment is blocking silently the export and it does not simply happen. My recommendation is to check the permissions/processes you have on the user machine and test the same outside of the local environment to compare the results.

open with default editor and wait to be closed

we're developing an app that should be able to open specified file with default editor application. (so if it is .doc - it suppose to be opened by MSWord or openOffice)
But I also need to wait until user will close the editor, check if it was changed (by size and date), and upload it to the server.
So the following steps:
1) find def editor
2) open file
3) wait it be closed
4) do smth after that with the file.
now results of my research:
-> opening by def editor is simple: file.openWithDefaultApplication();
but there is no way to know that editor is closed (maybe by checking that file is not locked in timer???)
-> i can start the native process and pass file as parameter BUT looks like the code
NativeApplication.nativeApplication.getDefaultApplication(file.extension);
does not work for any extension :( - it doesnt work for "rtf", "doc" but works for "pdf"... and [file.openWithDefaultApplication()] works fine with any file!
any suggestions?
thx in advance!
but there is no way to know that
editor is closed
Correct. I do not believe what you want to do is possible with AIR. How would AIR be able to tell whether the file is open or not? You might want to look into using NativeProcess; but that would be reliant on the underlying OS/default program exposing APIs to let you know when the program was open and/or closed.
My only suggestion is that you don't have the Air application watch the file, but instead show a popup that say 'click okay when done editing file' and then upload it based on that.
The only other way I can think of this working is if you create both a .bat and a .sh file
(for both windows and macs/linux; select one or the other depending on the os) which open the file you want through NativeProcess (and of course, put 'wait') and then listen for the close event.

Drag and Drop outlook attachment in to Adobe AIR

I would like to know if there is a way to drag and drop an attachment file from an outlook email that is open into an AIR application and for that file to be then accessible to the AIR application.
When I experimented with this the drag operation is giving AIR a File Promise List. But I'm not exactly sure how to make use of it once it is dropped. All the examples out there explain how to manupilate File Promises from an AIR application to the desktop. Nothing that explains a file promise into an AIR app. Any help is much appreciated.
AIR is like any other desktop application in this aspect: you are notified that a thing of type File Promise List is in the clipboard. You have to deal with this type (as any other desktop application would).
If this is the Windows clipboard call-back thing, then AIR's limitations might be a problem. Applications have the option, through the Windows API, to put a token in the clipboard rather than actually moving the data into global memory, which is what the clipboard is. If anyone actually wants the data, the original app gets a callback and supplies the byte stream.
If this is the case, AIR could do whatever the consumer application is supposed to do asynchronously, but I don't know if it does. Or it could be some particular Outlook thing.
Cheers
No, there is no way to drag and drop an attachment file from an outlook e-mail.
#Richard: AIR doesn't allow dropping message files to an AIR-Application.
Instead you receive a String, containing some mail info like subject, size, recipient.
No content, no attachments.
That's a pity...
Please feel free to correct me, but I have searched for a solution for a while and no solution found....
Greetings steelheart

Flash Projector with multiple windows, each with a new flashPlayer instance

Does anyone know of a flash projector 'project' or 'framework' that uses a new flashPlayer for each window?
We've used mProjector, which works well to a point, but I'm very disappointed in the fileIO patterns they use. It is very buggy with regard to reading and writing files.
mdm zinc uses multiple windows, but it is all sits on one flashPlayer 'session'. The same applies for AIR. It is great, but there isn't a way to make each window run on a seperate flashPlayer... extreme number crunching on one window will lock up all other windows.
Thank you in advance. --jeremy
edit - Just to clarify my needs (since I'm adding a little bounty), the app is an ERP application, built on Flex 3.x, and the size and scope of the project == huge.
tl;dr -- I need an exe wrapper (for windows), similar to AIR, that can have multiple windows, running each window on a seperate flashPlayer instance, and when a window is closed, it blows-away that flashPlayer instance / stage / etc.
How about a DotNet application to handle the wrapper? It can spawn windows each with it's own instance of the Flash Player (ActiveX dll) running in it.
I'm Sorry I found this too late to help you, but hopefully this saves someone else some work.
You can use SWF Studio to do this.
What you do is create a stub EXE that takes command line parameters to tell it which SWF to load. The parameter tells the EXE which SWF to load from its internal collection of files added to the SWF studio Files Tab. Whenever you need to open a new "window" you just execute your own EXE again and pass it the name of the SWF to use.
SWF Studio's App.sendData commands allows you to send data between youe various windows with very little effort so your separate applications can easily behave like they are all parts of a single application.

What is the best tool to make a CD-ROM Demo Application?

I have to make an application that will do the following:
Open a video file embedded in the application
Open some pdf files, preferably embedded in the application, but if it will have to open externally, it's no problem.
Work in fullscreen on the user computer, with a minimum resolution of 1024x768. I'm thinking about a resolution of 1024x768, centered on a black background.
I was thinking of using Flash, but I don't have much experience, so if there is another easier IDE that creates a Flash application, I would prefer that.
So, if anyone knows any Flash component to do this, I'll be very thankful.
Creating a Flash CDROM takes a little bit of care, but from my experience it's well worth it. From your requirements, the Flash IDE is well up to the task. The common requirements are as follows:
Windows / Mac platform
Flash Projector file
Autorun file (For the Windows platform)
Net access or all local
If your client is happy with creating the CDROM just for Windows, there will be very few dramas - but if they want to create a Mac-friendly version, you can do that too and I will explain afterwards.
Your Flash should preferably be an .exe projector file - the reason for this is so that the Windows user can open your app without downloading a Flash player (If the client wants a CDROM, they probably have limited net access, so this is a good thing!)
Within Flash, you can perform all your standard fs commands including full-screen.
You will likely need an Autorun file so that the user sees your application as soon as you put in the CDROM - simply create a file named 'autorun.inf' in notepad and enter the following:
[autorun]
open=yourProjector.exe
Where 'yourProjector.exe' is the name and path of your projector file.
It sounds like you're going to embed your videos and content in the CDROM - this is usually the ideal case, since your client won't receive annoying security messages, but this can also be a bad thing if you want to correct your content later (spotting errors after a thousand CDROMS have been distributed can be a PAIN).
You can serve some of your content online to avoid this, but it would give your user some ugly messages, so as long as you triple-check your content and embed everything, it would be the best scenario.
Now for a Mac, Apple has done away with autorun features years ago - there is a way to turn it on through Quicktime, but this is off by default for almost all Mac users, and turning it on is not recommended because it makes the Mac vulnerable to the 'Hong Kong Virus', one of the few Mac viruses around.
You can make your CDROM mac-friendly by creating a Mac Projector and adding instructions for how to use it by changing the background image of the CDROM window. I haven't had to do it before, but I hear that it's not too difficult.
You can use the Flash Projector. Here is a tutorial to get you started. Now, you won't be able to embed the PDF files but you can open them easily enough using fscommand("exec","foo.pdf")
You can create an Adobe AIR Application; however it won't run off the CD ROM; it'll need to be installed locally.
If creating a projector from Flash Pro doesn't work; look at a tool like Janus or Zinc

Resources