javascript - Angular 4 printing html template -
i'm trying find way print dynamic html view in angular 4.
this have currently. right print element rendered using id assigned it.
let printcontents, popupwin; printcontents = document.getelementbyid(this.printelementid).innerhtml; console.log(printcontents); popupwin = window; //popupwin.resizeto(window.outerwidth, window.outerheight); popupwin = popupwin.open('', `_blank', 'top=0,left=0,width=${window.outerwidth},height=${window.outerheight}`); popupwin.document.open(); popupwin.document.write(` <html> <head> <title>${this.printtitle}</title> <style></style> </head> <body onload="window.print();window.close()"> ${printcontents} </body> </html>` );} is there easy solution this?
Comments
Post a Comment