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




Reply via email to