Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function printElementSimple(elem){
- w=window.open();
- w.document.write($(elem).html());
- w.print();
- w.close();
- }
- document.getElementById('preview-viewer').contentWindow.print()
- function printElement(elem, style){
- if (document.getElementById != null){
- var html = '<HTML>\n<HEAD>\n';
- if (document.getElementsByTagName != null){
- var headTags = document.getElementsByTagName("head");
- if (headTags.length > 0) {
- html += headTags[0].innerHTML;
- }
- }
- html += "<STYLE>"+style+"</STYLE>";
- html += '\n</HEAD>\n<BODY>\n';
- var elem = elem
- if (elem != null) html += elem.innerHTML;
- else{
- alert("Error, no contents.");
- return;
- }
- html += '\n</BODY>\n</HTML>';
- var printWin = window.open("","PrintWindow");
- printWin.document.open();
- printWin.document.write(html);
- printWin.document.close();
- //printWin.print();
- } else alert("Browser not supported.");
- }
- var style = "td span, td del, td ins { word-break: break-word;} del { color: #000; background: #f88; text-decoration: none;} ins {color: #000; background: #9f9; text-decoration: none;}"
- printElement($('.pad-top-md>.ng-star-inserted'),style);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement