locked
how to open window print in the same tab RRS feed

  • Question

  • User-1634604574 posted

    i want to open window print in the same tab with full screen not in new tab 

    Saturday, January 18, 2020 6:42 AM

All replies

  • User288213138 posted

    Hi zhyanadil,

    i want to open window print in the same tab with full screen not in new tab 

    You can use the window.print method directly.

    <script>
            function fun() {
                window.print();
            }
        </script>
    
    <input id="Button1" type="button" value="button" onclick="fun()" />

    Best regards,

    Sam

    Saturday, January 18, 2020 8:00 AM
  • User-1634604574 posted

    i have this code but window print not show

      function printpage() {
    
                var sWinHTML3 = $("#div_content_print iframe").contents().find('body')[0];//header
                var sWinHTML4 = $("#div_content_print iframe").contents().find('body')[2];//footer
                var sWinHTML = $("#div_content_print iframe").contents().find('body')[1];
                var sWinHTML2 = $("#div_content_print iframe").contents().find('head')[1];
    
                var winprint;//= window.open("", "");
    
                 winprint.document.write('<html><head><style type="text/css">');
    
                 winprint.document.head.appendChild(sWinHTML2);
    
                 winprint.document.write('</style></head><body>');
    
                if($("#ch_letter_head").prop('checked') == true){
                winprint.document.write(sWinHTML3.innerHTML);
                winprint.document.write(sWinHTML.innerHTML);
                winprint.document.write(sWinHTML4.innerHTML);
                }
    
                  if(!($("#ch_letter_head").prop('checked') == true)){
                winprint.document.write(sWinHTML.innerHTML);
    }
    
                winprint.document.write('</body></html>');
    
                winprint.document.close(); 
                winprint.focus(); 
                winprint.print();
                winprint.close();
           
                }

    Saturday, January 18, 2020 8:35 AM
  • User288213138 posted

    Hi zhyanadil,

    var winprint;

    It should be window.

    var winprint = window;

    Best regards,

    Sam

    Saturday, January 18, 2020 9:23 AM