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:
@@ -16,6 +16,20 @@
|
||||
<body>
|
||||
<Routes @rendermode="InteractiveServer" />
|
||||
<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>
|
||||
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user