[ASP. NET] makes the page size suitable for Printing

Source: Internet
Author: User

Recently, when I was working on a web page that contains tables, I had a long history of problems. The specific manifestation is that when printing on my own computer, everything is normal, a piece of paper can accommodate the entire table. However, when printing on the customer's computer, the table occupies two sheets of paper, and the right part is missing.

I found a lot of information and finally found that this is a problem with the IE version. An "advanced printing" feature is added from IE7. The page content is automatically scaled during printing to fit the size of the printed paper. I use IE8 and the client uses IE6, so this is a strange problem.

After finding the cause, the solution will come out: Adjust the page range according to the paper size. The customer uses A4 paper, the width is 210mm, the height is 297mm, and the margin is 19mm mm. The size of the calculated table should be 172mm * 253mm. It is best to remove the header, take 170mm * 250mm. Otherwise, the border of the table may not be printed.

Next, set the width to 170mm and height to 250mm In the CSS style of the table. In this way, the table is smaller than the original one, so the font of the table must be reduced. According to the test, we found that the size of the A4 paper font with X-Small is enough.

This method looks stupid, But it finally handles this printing function. However, if you want this page to be viewed and printed in a browser, this method will be ineffective. Therefore, the fundamental solution is to upgrade Internet Explorer to version 7 or later.

If you have another perfect solution, please kindly advise!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.