Discussion Locked

How to set print margins via web page?

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Is it possible to manipulate printer margin settings via controls/code within a web page?
I have a web-based app which requires users to print web pages frequently. In order to print the full content on an 8.5x11 page requires use of 0.25" margins on the left & right side. Most web browsers don't use 0.25" as their default, so I'd like to override the default and use the desired (0.25") setting.

Please give your advice & direction on how I could approach this problem.

Thanks,
Pete

3 replies

by madestroitsolutions

Its not the print margins you have to set. The pages need to be designed to fit on a regular page. You cannot access the printer properties programmatically. If the pages were designed by you, make sure they fit in a regular screen. Its not going tobe easy (specially if all the pages are designed already)
There is a workaround for this kind of thing, but it only works with Internet Explorer, no other browser. Internet Explorer allows you to define a different page to be printed than the one the user is looking at. It sounds crazy, but it is a wonderfull thing. You include a tag in the section that will redirect the printer to a different page. So for example if you are looking at page01.html and you hit print, or print preview, the browser will show you page02.html instead. Its a pretty kewl trick. Here is the code:

* Where PrintPage.asp is the page you want printed when the user hits print or print preview

* Remember this goes on the section and it only works for IE.

Good Luck!

This discussion is closed to new replies.