Title: PDF Download saves the HTML page instead of PDF

HI,
I am trying to save the pdf file by popping up a Save As dialogue box. This works fine with IE 6.0 and IE 5.5 (basic) but in IE 5.5 SP1,2 the browser opens a Save as Dialogue box and saves the HTML page of the calling page, (In my case the frame-set page).

I am using the following code. Can someone help me fix this one. This is urgent please.


      document = new Document(PageSize.A4.rotate(), 10, 10, 10, 10);

                        // Create a Writer that listens to the document and writes the document into the PDF.
                        PdfWriter.getInstance(document, bytesToWrite);

      // Open the document.

                        document.open();

                        // Call method(to set data) with document and 2D array of data as arguments.

                        loadDocument();//loads the document object.

      document.close();


      response.setHeader("Expires", "-1");
      response.setContentType("application/pdf");

                          response.setHeader("Content-Disposition", "attachment;filename="+sCompleteFileName);

      response.setContentLength(bytesToWrite.size());

                        ServletOutputStream out = response.getOutputStream();
                        bytesToWrite.writeTo(out);
                        bytesToWrite.flush();
                        out.flush();
                        bytesToWrite.close();
                        out.close();

Thanks,
Akshat Jain
 

Reply via email to