June 17, 2011

Posted in:


Problem Downloading Large PDF Files In Internet Explorer

MicrosoftWe recently encountered an issue with IIS 7.5 on Windows Server 2008 R2 that breaks large PDF files when they get viewed or downloaded within Internet Explorer. In this situation, the company was creating large PDF files being generated by their customers on the fly and allowing them to be downloaded as needed. These files included large images and 100+ pages worth of important data and when IIS would go to serve these PDF’s to an IE browser, the browser wouldn’t display an error message and would crash or lock up.

We began investigating the problem and after eliminating variables like the web application firewall and custom ISAPI filters we opened a ticket with Microsoft. After a lot of testing with tools like Fiddler and WireShark. The problem is caused by byte chunking – when the server goes to send the PDF over to the browser, it chunks the bytes being transmitted which causes the Adobe reader to become confused and ultimately results in it crashing. By eliminating the byte chunking to transmit the PDF (basically forcing it to handle PDF’s the way Firefox and Chrome does) the problem goes away. This is done by creating a simple URL rewrite rule on the server. The rule and details on adding the rule in server wide can be found here: https://kb.edgehosting.com/KnowledgebaseArticle53046.aspx This rewrite rule checks for the User Agent to ensure it is an IE browser then checks for the .pdf extension within any and all URL’s. If the client meets that criteria, it forces the document to be sent without byte chunking. Enjoy!

Go back