IE framesets and printing

By | March 22, 2011

So I recently encountered a weird problem with printing in Internet Explorer. To ease the usability of a website we opened a new window that had a frame-set in it with 2 frames. The first frame contained a button to close the pop up and the second frame a clone of the page to be printed. This was done to apply a slightly different lay-out to the print version.

For some reason some of our customers reported that the print-out font size was bigger then it was supposed to be. And in some cases the tables didn’t even fit the page anymore. Surprisingly everything worked normally in Firefox, and only the customers using IE7 and above reported the issue.

After a couple of hours debugging it turned out that IE jumped into some weird rendering mode that caused the content not to fit a normal A4 page anymore. Appearantly adding the DOCTYPE definition to set it to compatability mode helped solving the problem. So I included the below to fix the issue:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

Leave a Reply