[英]How to show full html content on click of Print option using Angular8
I am working on Angular8 application, based on selection of dropdown, i have to print the whole html present based on selection of dropdown to be printed as shown in demo.我正在使用 Angular8 应用程序,基于下拉列表的选择,我必须根据要打印的下拉列表的选择来打印整个 html present,如演示中所示。
But here, i am not able to see the selected dropdown value, also contents displayed on the right side are hidden, and when the content is huge, i have added scroll in Additional comment section, when i click on print, i am able to see the scroll but not the content.但是在这里,我看不到选择的下拉值,右侧显示的内容也被隐藏,当内容很大时,我在附加评论部分添加了滚动,当我点击打印时,我能够看到滚动但不是内容。 Please help me to solve this issue.
请帮我解决这个问题。
TS: TS:
public downloadPdf() {
var printContent = document.getElementById('pdfDownload');
this.verticalScrollTrue = false;
$('pdfOpenHide').attr('hidden', true);
let documentClone = $("html").clone();
let printContainer = "printwrap";
documentClone[0].getElementsByTagName('body')[0].innerHTML = "<div id='" + printContainer + "'>" + printContent.innerHTML + "</div>";
let WinPrint = window.open('', '', 'left=300,top=0,width=1000,height=700,toolbar=0,scrollbars=0,status=0');
WinPrint.document.write(documentClone.html());
WinPrint.document.close();
WinPrint.focus();
setTimeout(() => {
WinPrint.print();
WinPrint.close();
}, 1000);
}
To get rid of the scroll remove the css class "vert-scrollable-150".要摆脱滚动,请删除 css class “vert-scrollable-150”。
Change:改变:
<ul class="list-group list-group-flush vert-scrollable-150">
To到
<ul class="list-group list-group-flush">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.