如何通过javascript打印没有网址和日期时间 [英] how to print without url and datetime by javascript

查看:146
本文介绍了如何通过javascript打印没有网址和日期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过javascript使用以下代码打印div标签内容。

I want to print the div tag content by javascript by using the following code.

var divToPrint1 = $('#PrintDoc').html();
 var newWin = window.open('Share Certificate #001', '', 'width=10px,height=10px');
 newWin.document.open();
 newWin.document.write('<html><body onload="window.print();">' + divToPrint1 + '</body></html>');
 newWin.document.close();
 setTimeout(function () { newWin.close(); }, 10);

打印代码工作正常。但现在我想使用javascript代码从打印页面中删除网址,日期和标题。

And print code works fine. But now I want to remove the url, date and title from the printed page by using the javascript code.

有可能吗?
你能帮我解决下面的代码吗?

Is it possible? Can you help me to solve the following code?

推荐答案

我见过的唯一一个没有打印的在线应用程序页眉和页脚是Google文档。然而,经过一些搜索,我发现gdocs实际上生成了一个pdf文件,打开了该文件,并从那里打印出来。如果这是Google找到的最佳方式,我会建议您查看相关信息。

The only online application I have seen that prints without the header and footer is Google Docs. However, after some searching I discovered that gdocs actually generates a pdf file, opens that file, and the prints from there. If that's the best way that Google has found to do it, with all their resources, I would suggest looking that direction.


页眉和页脚由你的打印子系统放在那里
,而不是
页面或浏览器。这意味着
是,这个特殊属性在
手中用户。就像
屏幕分辨率或更宽的宽度一样。 -
来自网页设计论坛的答案

这是一项服务(虽然付费),我发现它将通过http post生成pdf。 这里是一个(似乎)有希望的)所以关于使用asp.net生成pdf的问题

This is a service (paid though) that I found that will generate a pdf via http post. And here is a (seems promising) s.o. question about generating pdfs using asp.net

这篇关于如何通过javascript打印没有网址和日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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