I am using the navigateToUrl on a current project. The trick is to make a URLRequest with URLVariables that
contain the data on which pdf to use/view. However, if I remember correctly, there could be issues with sessions validation.
Ok that is one approach unfortunately it involves saving the pdf (its currently in a byteArray) to disk, either on the server or in the client, but for it to work correctly I would have to save it on the server side otherwise I would have to prompt the user with a save dialog and there is no way I could retrieve the full path of the saved file, all this because of security restrictions.
Since we are using EJBs in a clustered Weblogic server file access is not recommended, further more there is no need to store the pdf file since its going to be printed only once.
To make things worse it has to be a web application NOT Air so I cannot use its pdf functionality.
So I have the pdf in a byteArray on the client side, what's next?
1 person found this helpful
Normally how we do is to open another browser with the ID of the report to open, the new browser window will do a POST request to get bytestream of the pdf as the response.
So basically it cannot be done within Flex, I have to let the browser do the job, and for that to work I need a HTTP Servlet that receives the browser's request and sends the file back as response.
If you wnt the pdf to be show inside the flex application, then you can use IFrames. The HTML page which i was refering to in my previous post can be opened inside the flex application itself using the Iframes, but the Iframe is not a good way of doing it, it does not always work as expected, there will b a lot of performance and UI related issues with it.
I have never found a solution, other then flex-iframe solution. But my question is "How do they display the PDFs in Acrobat.com? which is a flash app". It must be possible Adobe just doesnt want to let us do it.
Other way of doing it is to convert the .pdf file to .swf file and load it
using the swf loader, may b you are seeing that in the acrobat.com. if you
have very limited number of pdf files then this process is good, if you have
dynamic way of generating pdf then this wont work. You can google on this.
By any chance can you convert it into an image, png for example?
Thats true. I have used print2flash (print2flash.com) or flashpaper before the is also swftools. but no one wants to have to convert there PDFs to a swf before they can use it. That is only an acceptable work around if you know what pdf you want to display before hand. if the PDF are going to uploaded by the user then you will need to have some tool to convert them. Then your application will have to retain 2 copies of the file.
I don't think Acrobat.com converts the PDF to a swf and if it does what do they use because they discontinued flashpaper. Maybe its part of livecycle?
Thanks for the tip but having a partial solution that:
" is not a good way of doing it, it does not always work as expected, there will be a lot of performance and UI related issues"
Its not acceptable.
brian.kimball you are absolutely right the requirement is for dynamically generated PDFs and how want's to transform that into any other format?
Isn't PDF the most widely used document format? Why use another format?
Seems to me that is a serious limitation for flex web application (RIA), that has been around for a while and still unanswered.