删除URL并从打印页面打印文本 [英] remove url and print text from the printed page

查看:198
本文介绍了删除URL并从打印页面打印文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个Web应用程序,在我的网页中有一些数据显示,包括
常见的页眉,页脚,菜单和其他图像。所以我添加了一个小按钮作为print
预览,以便用户只能看到数据。用户点击打印预览按钮后,数据显示
作为弹出窗口,在该弹出窗口中我添加了一个按钮调用打印,以便用户可以点击它并从该页面打印出来。



这个打印按钮直接调用onClick事件中的window.print(),它工作正常我可以得到打印输出。



问题是在我的打印页面上,我可以找到打印文本是按钮字幕和上面
我可以找到的URL是 http:// localhost / ..............



因此,有一种方法可以删除这些打印文字和网址



这是打印预览按钮的功能。

  function printPreView(reportCategory,reportType,transactionType,searchOption,customerRokaID,utilityCompany,fromDate,toDate,telcoName,bank){

var request =selectedMenu =+ reportCategory +& loginStatus = success& criteria =+ searchOption +& customer =+ customerRokaID +& from =+ fromDate +& to =+ toDate + nspTypes =+ utilityCompany +& trxTypes =+ transactionType +& options =+ reportType +& telcoTypes =+ telcoName +& bankTypes =+ bank +& printable = yes


window.open(report / showReport.action?+ request,null,location = no,menubar = 0,resizable = 1,scrollbars = 1,width = height = 700);
}

这是我如何把我的打印按钮

 < form> 

< input type =buttonvalue =PrintonClick =window.print()>

< / form>


解决方案

,页码等)由网络浏览器自动添加。基本上,设置只能由用户更改。本主题将详细讨论该问题



对于按钮本身,您可以使用特定的打印CSS隐藏它,如那个问题。正如MMacdonald所说,你可以对其他元素使用这种技术,这样你不需要重新渲染你的页面。但是,您会失去预览功能(用户仍然可以使用浏览器的打印预览功能)。


I have developed a web application and in my web page there are some data displays with common headers, footers , menus and other images. so I have added a small button as print preview so that user only can see data. After user click on print preview button only data display as a popup and in that popup I added a button call print so that user can click on it and take a print out of that page.

this print button directly call to window.print() in onClick event and it working fine I can get the print outs.

but my problem is in my printed page on top of that I can find the "Print" text which is button caption and in above that I can find the url which is something http://localhost/..............

So is there a way that I can remove those print text and url from my printed page.

Many Thanks

this is what the print preview button do .

function printPreView(reportCategory,reportType,transactionType,searchOption,customerRokaID,utilityCompany,fromDate,toDate,telcoName,bank){

var request = "selectedMenu="+reportCategory+"&loginStatus=success&criteria="+searchOption+"&customer="+customerRokaID+"&from="+fromDate+"&to="+toDate+"&nspTypes="+utilityCompany+"&trxTypes="+transactionType+"&options="+reportType+"&telcoTypes="+telcoName+"&bankTypes="+bank+"&printable=yes";


window.open ("report/showReport.action?"+request,null,"location=no,menubar=0,resizable=1,scrollbars=1,width=600,height=700");
}

Here is how I have put my Print button

 <form>

   <input type="button" value="Print" onClick="window.print() ">

 </form>

解决方案

The header with the URL (and sometimes the page title, page number etc.) is automatically added by the web browser. Basically the settings can only be changed by the user. This topic is discussed in details in that question

For the button itself, you could hide it using specific print CSS as discussed in that question. And as MMacdonald said, you can use this technique for other elements as well so that you don't need to re-render your page. But then you would lose the preview feature (the user could still use the browser's print preview feature).

这篇关于删除URL并从打印页面打印文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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