You cannot load .pdf files into the flash player, I think you will have to open a new window or load it into an iFrame on top of your application à la Coenraets ( http://coenraets.com/viewarticle.jsp?articleId=95 )
 
Philippe Maegerman


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jesus Salvador Ramos Cardona
Sent: lundi 22 août 2005 16:50
To: flexcoders@yahoogroups.com
Subject: [flexcoders] About downloading files in Flex

Hi all,

 

We have developed a Flex app which is in production now. However, we have a new requirement, which asks for the ability to download PDF files. These files are reports that are generated dynamically. I have successfully set up the report generation, and am using this piece of code in my Delegate (since we are using the cairngorm microarchitecture) to make it work:

 

public void printDetalleLineaBancaria(String ticket, Integer idDetalleLiquidacion, String status) throws FileNotFoundException, IOException {

        HttpServletResponse response = Gateway.getHttpResponse();

        response.setContentType("application/pdf");

        response.setHeader("Content-Disposition", "attachment;filename=\"MyReport.pdf" + "\"");

        byte[] b = generateJasperReport("MyReport");

        response.setContentLength(b.length);

        int offset = 0;

        int numRead = 0;

        while (offset < b.length && (numRead = fis.read(b, offset, b.length - offset)) >= 0) {

            offset += numRead;

        }

        fis.close();

        response.getOutputStream().write(b);

    }

 

I am associating this method to a button, gong through all the cairngorm components. However, I am not getting any results. The browser's status bar indicates it is loading something, then it stops and freezes with "Transferring Data from localhost.".

 

Is this the right way to do it? Is the result of my stream going through the Flash gateway? What is the best way to satisfy this requirement?

 

Help, please!

 

J.

 

Jesús Ramos Cardona
Desarrollo de Sistemas de Casa de Bolsa

[EMAIL PROTECTED]

+52 (55) 51 74 22 22 ext. 1250

Ixe Grupo Financiero

Este correo electrónico y sus anexos pueden contener información CONFIDENCIAL para uso exclusivo de su destinatario. Si ha recibido este correo por error, por favor, notifíquelo al remitente y bórrelo de su sistema. Muchas gracias. Las opiniones expresadas en este correo son las de su autor y no son necesariamente compartidas o apoyadas por la compañía. Ixe Grupo Financiero no asume aquí obligaciones ni se responsabiliza del contenido de este correo, a menos que dicha información sea confirmada por escrito por un representante autorizado. No se garantiza que la transmisión de este correo sea segura o libre de errores, podría haber sido viciada, perdida, destruida, haber llegado tarde, de forma incompleta o contener VIRUS.

 



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




------------------------------------------------------------------
**STATEMENT OF CONFIDENTIALITY**

This e-mail and any attached files are confidential and intended solely for the use of the individual to whom it is addressed. If you have received this email in error please send it back to the person that sent it to you. Any views or opinions presented are solely those of author and do not necessarily represent those the Emakina Company. Unauthorized publication, use, dissemination, forwarding, printing or copying of this email and its associated attachments is strictly prohibited.

We also inform you that we have checked that this message does not contain any virus but we decline any responsability in case of any damage caused by an a non detected virus.
------------------------------------------------------------------

Reply via email to