Forced webpage to print in legal paper

In an intranet web application , I have a web page that needs to be printed by a user on legal (8 1/2 "x 14") paper.

Is there a way I can use CSS or JavaScript to tell the browser to request (or optimize for) this paper size? If it doesn't, is it at least possible to change the default printer settings for that particular web page so that the user doesn't have to manually enter Legal Paper?

Thanks in advance for your kind responses.

+3


source to share


3 answers


This cannot be done with standard CSS or JavaScript. You might be able to do this with ActiveX, but I can't say for sure and even then it will only work in IE.



+3


source


You can try CSS and see if it works for you. It seems to work with several of my printers, but not all.



@media print {
    body {
    width:816px;
    height:1344px;
    }

      

+1


source


If this cannot be done with CSS / JS, an alternative would be to dynamically create a PDF that is legal sized from HTML. There are many HTML to PDF converters, one of the best open source options is mPDF

+1


source







All Articles