简体   繁体   中英

how to print a document without having displayed the address at the bottom of the page in php or javascript

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
              <script language="Javascript1.2">

                var message = "Print";
                function printpage() {
                window.print();

                }

                document.write("<center><input type=submit class=print id=non-printable value=print  onClick=\"printpage()\"/></center>");

            </script>
</body>
</html>

i want to generate bill but with this code but it displays address at the bottom of the page which will be printed, i dont want the address to be displayed at the bottom. Please help with code in php or javascript.

This is a browser setting and can't be altered using PHP/Javascript. Check your browsers printer settings to disable the header/footer text upon printing.

For creating reports I suggest you have a look at the PHPExcel library .

考虑到谷歌文档创建一个PDF,然后打印,我建议你做同样的

What you are asking for is somehow disabling the headers and footers that is added while printing.

This is actually a print option and can be disabled in print settings.

There is a workaround in CSS that you can use. Note: Works only in Modern Browsers.

<head>
 <style type="text/css" media="print">
  @page 
  {
    size: auto;   /* auto is the initial value */
    margin: 0mm;  /* this affects the margin in the printer settings */
  }

  body 
  {
    background-color:#FFFFFF; 
    border: solid 1px black ;
    margin: 0px;  /* this affects the margin on the content before sending to printer*/
  }
  </style>
  </head>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM