Friday, October 31, 2008

Why IE only prints the first page?

A few days ago, an issue was escalated to me that one of the web report can only print one (first) page in IE, even the report has three pages. It appeared in Print Preview that there is only one page. But if you look it in Firefox 3.0, you can see three pages in preview and can print all three pages.

The problem is with the css file (Cascade style sheet) with "absolute" keyword.

In the CSS file referred in the webpage, there is a section like this:
div.outbox
{
position: absolute;
left: 65px;
top: 30px;
}

When the page has a DIV tag called the class as <DIV class="outbox" >, or you have a tag like <div style="position:absolute; left:65px; top:30px;" >, IE will mis-interpret the keyword and stop at first page.

In the next example, I changed the keyword "absolute" to "relative":
.outbox2
{
position: relative;
left: 65px;
top: 30px;
}

This solved the "IE only prints first page" issue.

If you encountered similar error and solved with different methods or a different tag/keyword caused the error, please kindly post a comment here to share with other viewers. Thanks.

No comments: