Task: make the site so that the image file is automatically sent to the printer. The print itself is easily run through window.print() , but the printed result is obtained in different sizes from different browsers: from IE, as planned, on the entire A4 sheet, from Firefox, the picture takes less than a quarter of the sheet, from Opera and Chrome - something the average. I tried to set the size of the image through CSS, indicating inches (in) as the unit of measurement does not help.

How to make the picture printed on a full sheet of any browser?

UPD: Solved the problem by setting the width for the picture: 100% through css media = print

    3 answers 3

    Browsers practically do not allow to control print settings. For Oprah and Chrome, you can specify indents in CSS:

     @media print{ @page: {margin: 0%} } 

    The rest of the browsers ignore this, substitute the values ​​specified by the user (or by default). The same goes for footers - completely custom setting. And since printing a picture with the same settings indented, footers and daws "across the page" is printed the same way.

    Set the image width:100% in the rules for @media print , further will depend on the user.

      Option 1: redefine css images via @media print {}.
      Option 2: Before printing, set the desired print settings. But the user will be engaged in it - all the same, its printer.

        Especially for you, I thought, and that's what I came up with:

         function atoprint(src) { var atext = '<img src="' + src + '">'; var captext = window.document.title; var alink = window.document.location; var prwin = open(''); //prwin.document.open(); prwin.document.writeln(htmls.text3); prwin.document.writeln('<h1>'+captext+'<\/h1>'); prwin.document.writeln('<div style="position: absolute; height: 600px; top: 150px; width: 700px;">'+atext+'<\/div>'); prwin.document.writeln('<hr><div style="font-size:8pt;margin-top:20px;">© site.ru<\/div>'); prwin.document.writeln('<div style="font-size:8pt;">Страница материала: '+alink+'<\/div>'); prwin.document.writeln('<\/div><\/body><\/html>'); prwin.print(); prwin.close; }; 

        pass only src well and in the markup that I have too you can fix something!