feat: Add custom print title JS function

Adds printWithTitle function to set document title before printing for
better file naming when saving as PDF.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-01 23:56:37 -05:00
parent ed911a13ba
commit bf6c4764ed

View File

@@ -16,6 +16,20 @@
<body> <body>
<Routes @rendermode="InteractiveServer" /> <Routes @rendermode="InteractiveServer" />
<script src="_framework/blazor.web.js"></script> <script src="_framework/blazor.web.js"></script>
<script>
function printWithTitle(title) {
const originalTitle = document.title;
document.title = title;
const restoreTitle = () => {
document.title = originalTitle;
window.removeEventListener('afterprint', restoreTitle);
};
window.addEventListener('afterprint', restoreTitle);
window.print();
}
</script>
</body> </body>
</html> </html>