views:

108

answers:

1

Hi,

We have a magento commerce site running on an IIS 6.0 server with PHP 5.2.11 running magento.

Whenever user tries to use the print to download pdf to their computer from the admin panel the download does not complete. I can see that the full file is downloaded to the computer but the browser still keeps on saying it is downloading. This means the file gets save with a .part in the end and users cant open the file as pdf. If i remove .part extension created by firefox then i can view the pdf correctly. This means the data is sent to the browser from server in full but download does not terminate.

See headers below on response while starting to download the pdf

HTTP/1.x 200 OK
Cache-Control: must-revalidate, post-check=0, pre-check=0
Pragma: public
Content-Length: 1456781
Content-Type: application/pdf
Content-Encoding: gzip
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Last-Modified: Fri, 18 Dec 2009 10:23:37 +0000
Vary: Accept-Encoding
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET, PHP/5.2.11
Content-Disposition: attachment; filename=invoice2009-12-18_10-23-37.pdf
Date: Fri, 18 Dec 2009 10:23:37 GMT

I guess it is something to do with not closing the connection after sending the whole file through? Please help!

Thanks.

+1  A: 

Have you tried explicitly calling exit; after you output the pdf data. Sounds like an IIS thing.

Question Mark
where do i use the exit();The pdfinvoicesAction() is called from the OrderController.php and the Invoice.php files.There is a _prepareDownloadResponse function that is being used to create the PDF's.Is there an IIS setting?
ToughPal
No idea about an IIS setting, exit needs to go after _prepareDownloadResponse outputs to the browser (sorry my version of magento doesn't have pdf invoices so can't say exact)
Question Mark
Thanks Mark, I tried exit() after the $this->_prepareDownloadResponse and now download does not happen. I am trying to figure out where exactly to place the exit().
ToughPal