locked
How to remove Date & Url RRS feed

  • Question

  • User-797751191 posted

    Hi

      When printing using window.print() i want that Date & Url should not get printed.

    Thanks

    Friday, June 14, 2019 7:45 AM

All replies

  • User-1038772411 posted

    Hello jsshivalik,

     you can do this by adding the little css code to Your pages.
    Below is the Example which will Hide the Header in print command.

    You can easily check, Copy & paste the Below code in page.
    Save that file as .html, 

    Open it and then give the Print Command.. 

    You will not get Header in your printout. CSS will hide that Header Control.

    Try below code, I hope this wil help you

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
    <HTML>
    <HEAD>
    <TITLE>YOUR PAGE TITLE</TITLE>
    <style>
    @media print {
    .header, .hide { visibility: hidden }
    }
    </style>
    </HEAD>
    <BODY>
    <DIV class="header">BODY CONTENTS OF YOUR PAGE GOES HERE</DIV>
    <P>The body...</P>
    <input type="button" onClick="window.print()" class="hide"
    value="Print"/>
    </BODY>
    </HTML>

    Apply the Necessary changes to your pages.

    Reference : https://forums.asp.net/t/1834427.aspx?How+to+print+a+web+page+without+URL+DATE+PAGE+NUMBER

    Thank you.

    Friday, June 14, 2019 8:01 AM
  • User665608656 posted

    Hi jsshivalik,

    The @page at-rule has been standardized, which can be used to hide the page title and date in modern browsers when you want to print the page.

    You could refer to the code as below:

    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <style type="text/css">
            @page {
                size: auto;
                margin: 0mm;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <h4>Welcome to ABC page!</h4>
            </div>
            <input type="button" onclick="window.print()"  value="print"/>
        </form>
    </body>
    </html>
    

    The result of this work demo:

    Best Regards,

    YongQing.

    Friday, June 14, 2019 9:56 AM