> I call a servlets which renders a pdf stream to the browser. My question
> is the window name defaults 
> to how I called the servlet I need for it to be more specific as to what
> type of report I'm displaying 
> because our users need to email these reports and it seems that it takes
> the window name as the file 
> name.
> 
> The PDF is rendered into another window. WE are using FOP to dynamically
> build PDF files. When opening the new window we have a default HTML page
> letting know the user that the page will load momentarily. So on the
> onload of the default page we call the servlet through the function
> LoadPDF().
> 
> function loadPdf(){
> var url = document.URL;
> pos = url.indexOf("=");
> var strPdfUrl = url.substring(pos+1);
> top.location.replace(strPdfUrl);
> self.focus();
> 
> }
> 
> public static byte[] getPDFStream(String i_strFO) throws Exception {
>     try {
>         ByteArrayInputStream sbFO = new
> ByteArrayInputStream(i_strFO.getBytes());
>          InputSource foFile = new InputSource(sbFO);   
>           ByteArrayOutputStream out = new ByteArrayOutputStream();
> 
>         Driver driver = new Driver(foFile, out);
>         driver.run();
> 
>         return out.toByteArray();
>     } catch (Exception ex) {
>         throw ex;
>     }
> }
> public void renderFO(byte[] i_foContent,
>                          HttpServletResponse response) throws
> ServletException {
>         try {
>          
>             response.setContentType("application/pdf");
>             response.setContentLength(i_foContent.length);
>             response.getOutputStream().write(i_foContent);
>             response.getOutputStream().flush();
> 
>         } catch (Exception ex) {
>             throw new ServletException(ex);
>         }
> 
>     }
> I've tried to set reponse.setHeader("Content-Disposition",
> "filename=myfile.pdf"); that still doesn't work.  Is there a way in
> creating the FO file to set the title of the document or of the window the
> PDF will open into. 
> 
> Thanks
> 
> 
> 

Reply via email to