Improved printing

This commit is contained in:
Taylor Courage 2025-01-21 14:31:17 -05:00
parent 98e0a1ffdb
commit f98c616fc3
3 changed files with 18 additions and 3 deletions

View File

@ -118,6 +118,12 @@
}
@media print {
@page {
margin-top: 0;
margin-bottom: 0;
margin-right: 0;
margin-left: 0;
}
#inputArea {
display: none;
}

View File

@ -315,11 +315,20 @@ function printScreen() {
} else { // re-format the number if it's 'wrong' i.e. "130"
outputSize = outputSize / 1000;
}
console.log(outputSize);
var outputText = outputSize + "\" (" + toMillimetres(outputSize) + " mm)";
// Create and set the header
subtitle.innerHTML = "For " + inputText + " to " + outputText;
reductionCount.innerHTML = "Across " + numDies + " reductions";
// Change the name of the window to save the file with the same
var pageTitle = document.getElementById("pageTitle");
var title = pageTitle.innerHTML;
pageTitle.innerHTML = "Draft Analysis for " + inputSize + " to " + outputSize;
// Let the browser handle printing
window.print();
// Reset the page title back to normal
pageTitle.innerHTML = title;
}

View File

@ -7,7 +7,7 @@
<script src="analyser.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<link rel="stylesheet" href="analyser.css" type="text/css" />
<title>Wiredraw Setup Analyser</title>
<title id="pageTitle">Wiredraw Setup Analyser</title>
</head>
<body>