Skip to content

Commit 549b357

Browse files
Merge pull request #138 from Jawin-SF4519/ES963343-PrintHTMLStyle
963343: Updated PrintHtml sample
2 parents ab0392c + 5b12e11 commit 549b357

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed
Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
window.print = function print(id) {
2-
var printContent = document.getElementById(id);
2+
var printContent = document.getElementById(id).innerHTML;
33
var WinPrint = window.open('', '', 'width=900,height=690');
4-
WinPrint.document.write(printContent.innerHTML);
4+
// Apply required styles (e.g., Syncfusion theme or custom CSS)
5+
WinPrint.document.write('<link rel="stylesheet" type="text/css" href="_content/Syncfusion.Blazor.Themes/bootstrap5.css">');
6+
WinPrint.document.write(printContent);
57
WinPrint.document.close();
6-
WinPrint.focus();
7-
WinPrint.print();
8-
WinPrint.close();
9-
}
8+
WinPrint.onload = function () {
9+
setTimeout(function () {
10+
WinPrint.focus();
11+
WinPrint.print();
12+
WinPrint.close();
13+
}, 100);
14+
}
15+
};

0 commit comments

Comments
 (0)