Search code examples
cssprintingstylesheetbing-maps

Bing Maps printing issue in Internet Explorer 8 standards mode


I'm working on adding basic print functionality to a web map application I recently built, and I can't seem to make the printing work properly when using Internet Explorer 8 in standards mode. I was hoping that someone with more CSS experience might be able to help.

I've created a basic example on jsbin that demonstrates what I'm seeing: http://jsbin.com/osepov/16. This example prints properly in most browsers. In Internet Explorer 8 in standards mode, however, the map's tile images run off of the first page and onto a second page when printing. I've tried a bunch of different CSS combinations, and have browsed the web for hours looking for hacks that might solve the problem. I've obviously had no luck thus far.

Being that the print functionality works well in most browsers, I am willing to compromise on a few things, if needed, to get this working in Internet Explorer 8 standards mode:

  1. The map doesn't have to fill the entire page, minus the header. It can have a fixed height.
  2. The header is nice to have, but I'm willing to do without it.

I know it is possible to build a PDF on the server, but I really want to do this with a simple print stylesheet.

Note: Yes, I do have to support IE 8 standards mode. I had a solution that kicked IE8 users to IE7 mode, but this was not acceptable to my client.


Solution

  • UPDATE 2: I was able to resolve the issue by bumping IE8 down to IE7 standards mode. The map is printing correctly now.

    UPDATE: Nope, this didn't solve the problem. I'm still seeing the same issue. This seemed to work, but I'm still seeing the problem.

    ORIGINAL POST: I think I figured this out. Basically, it seems like the "top" div was causing the entire page to get bumped down and run over to a second page when printing in Internet Explorer 8 standards mode. I'm not sure why this was just happening in IE8 and not in other browsers, but there are all sorts of strange IE-only bugs that I don't understand.

    The final fix:

    #wrapper {height:100%;left:0px;position:absolute;top:0px;width:100%;}
    #top {height:70px;position:relative;width:100%;}
    #main {height:785px;overflow:hidden;position:absolute;top:70px;width:100%;}
    

    So positioning the "top" div relatively and assigning a pixel height and "overflow:hidden" to the "main" div seemed to solve the problem.

    This isn't a perfect solution, but it meets my current requirements.

    Here's the updated solution: http://jsbin.com/osepov/19.