简体   繁体   English

jQuery Print-打印前显示预览

[英]jQuery Print - Show Preview before print

I would like to print a portion of the page, that is a div. 我想打印页面的一部分,即div。 Also I need css files referred, so it will get printed as we see in the page. 另外,我需要引用css文件,以便将其打印出来,如我们在页面中所见。

I tried to use jQPrint then printThis . 我试图使用jQPrint然后使用printThis But my IE7 browser was getting crashed when i click a button on second time. 但是,当我第二次单击按钮时,我的IE7浏览器崩溃了。 Not sure what is the problem. 不知道是什么问题。 My page has lot of elements (100+ input fields and 3 Grids) 我的页面上有很多元素(100多个输入字段和3个网格)

Finally, I followed this http://www.bennadel.com/blog/1591-Ask-Ben-Print-Part-Of-A-Web-Page-With-jQuery.htm and implemented. 最后,我遵循了这个http://www.bennadel.com/blog/1591-Ask-Ben-Print-Part-Of-A-Web-Page-With-jQuery.htm并实现了。 Now no crash! 现在没有崩溃!

Now how can I show a print preview dialog before sending printer? 现在,如何在发送打印机之前显示打印预览对话框?

Something like this https://github.com/etimbo/jquery-print-preview-plugin , I tried this too but its not working :( 像这样的https://github.com/etimbo/jquery-print-preview-plugin ,我也尝试过这个,但是不起作用:(

I did this same task in a prior job, and completed y the following example. 我在上一份工作中做了同样的任务,并完成了以下示例。 We set it up to where what ever part of the design we were sending to a printer, we would replicate the HTML, and create a dynamic page with that content, and then trigger the browser print dialog. 我们将其设置为要发送到打印机的设计的任何部分,我们将复制HTML,并使用该内容创建一个动态页面,然后触发浏览器打印对话框。 If you want to do what you are asking, without a lot of "magic", this is a good way to handle it. 如果您想做自己想做的事,而又没有很多“魔术”,这是处理它的好方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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