I need to print the content of the html sub-page and how to write the code



  • In the process of developing qwebwngine, I need to call subpage printing.
    parent html code

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    </head>
    <body>
    <iframe src="print.html" id="printf" name="printf" frameborder="0" width="200"></iframe>
    <input type="button" value="print child" onclick="document.getElementById('printf').contentWindow.prints();" />
    </body>
    </html>
    

    child html code

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="UTF-8">
    </head>
    
    <body>
        <p>child page!</p>
        <div id="name">im child page!</div>
    <script>
    function prints(){
    	window.print();
    }
    </script>
    </body>
    </html>
    

    I need to print the content of the sub-page and how to write the code,
    Do not print the buttons on the parent page.


Log in to reply