打印HTML时删除默认的浏览器页眉和页脚 [英] Remove the default browser header and footer when printing HTML

查看:230
本文介绍了打印HTML时删除默认的浏览器页眉和页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用< body onload =window.print()> 获得了一个HTML。



我想问的问题是:


  • 有没有如何删除Web浏览器添加到打印页面的字符串?

  • 如:


    • 打印页面

    • 页数

    • 网页标题

    • 打印日期
    • li>


解决方案

Google文件现在绕过此问题,方法是生成文档的PDF版本。



如果您使用的是Chrome,它会自动在新选项卡中打开PDF并弹出打印对话框。其他浏览器会提示您下载结果文件(这不一定是明显的行为)。

虽然我不认为这是一个优雅的解决方案,但应该是能够使用大多数现有的网络技术相当容易地重新创建。


I got an HTML with the <body onload="window.print()">.

The question I'm trying to ask is:

  • Is there any way to remove the strings that the web browsers add to the printed page?
  • Such as:
    • Web site from where the page was printed
    • Page count
    • Title of the web page
    • Date of printing

解决方案

Google Docs is now skirting around this issue by generating a PDF version of your document.

If you are using Chrome, it will automatically open the PDF in a new tab and pop up the print dialog. Other browsers will prompt you to download the resultant file (which is not necessarily obvious behavior).

While I don't find this to be an elegant solution, one should be able to recreate this fairly easily using most existing web technologies.

这篇关于打印HTML时删除默认的浏览器页眉和页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆