我可以在打印前编辑内容? [英] I can edit the content before printing?
本文介绍了我可以在打印前编辑内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我打印
receiptSectionTable2Col> < table class ==nofollow noreferrer>此链接
我该如何打印此表的内容。 这可能吗? https://stackoverflow.com/a/36372605\">这回答问题可以帮助你:
HTMLElement.prototype.printMe = printMe;
函数printMe(查询){
var myframe = document.createElement('IFRAME');
myframe.domain = document.domain;
myframe.style.position =absolute;
myframe.style.top =-10000px;
document.body.appendChild(myframe);
myframe.contentDocument.write(this.innerHTML);
setTimeout(function(){
myframe.focus();
myframe.contentWindow.print();
myframe.parentNode.removeChild(myframe); // remove frame
},3000); //等待图像加载iframe
window.focus();
}
您的情况使用情况:
document.getElementsByClassName(receiptSectionTable2Col)[0] .printMe();
The first chrome plugin to work. I do not have detailed information.
Before I print the contents of This link I want to get the specific part.
<table class="receiptSectionTable2Col" >
just how can I print the contents of this table. Is this possible?
解决方案
I think this answer from this question will help you:
HTMLElement.prototype.printMe = printMe;
function printMe(query){
var myframe = document.createElement('IFRAME');
myframe.domain = document.domain;
myframe.style.position = "absolute";
myframe.style.top = "-10000px";
document.body.appendChild(myframe);
myframe.contentDocument.write(this.innerHTML) ;
setTimeout(function(){
myframe.focus();
myframe.contentWindow.print();
myframe.parentNode.removeChild(myframe) ;// remove frame
},3000); // wait for images to load inside iframe
window.focus();
}
Usage in your case:
document.getElementsByClassName("receiptSectionTable2Col")[0].printMe();
这篇关于我可以在打印前编辑内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文