Add an alert reminding user to set the scaling correctly when printing.

This commit is contained in:
Skylar Grant 2026-01-08 12:37:48 -05:00
parent a34ee8c3fd
commit 9101f7f877

View File

@ -1,7 +1,7 @@
/* ITS Thermal Receipt Printer /* ITS Thermal Receipt Printer
* Developed by Skylar Grant for MCCS ITS * Developed by Skylar Grant for MCCS ITS
*/ */
const version = "1.2.6"; const version = "1.2.7";
// ############################################################# // #############################################################
// Variables // Variables
// ############################################################# // #############################################################
@ -94,7 +94,6 @@ function tempPasswordHandler() {
const lineArray = prepTempPassword(password, username); const lineArray = prepTempPassword(password, username);
const bUrl = generateFile(lineArray, true, true); const bUrl = generateFile(lineArray, true, true);
displayPdf(bUrl); displayPdf(bUrl);
if (window.navigator.userAgent.includes('Firefox')) printPdf();
} }
function customNoteHandler() { function customNoteHandler() {
@ -109,7 +108,6 @@ function customNoteHandler() {
const lineArray = prepCustomDetails(customNoteDetails); const lineArray = prepCustomDetails(customNoteDetails);
const bUrl = generateFile(lineArray, true, false); const bUrl = generateFile(lineArray, true, false);
displayPdf(bUrl); displayPdf(bUrl);
if (window.navigator.userAgent.includes('Firefox')) printPdf();
} }
function deviceTrackerHandler() { function deviceTrackerHandler() {
@ -141,7 +139,6 @@ function deviceTrackerHandler() {
const lineArray = prepDeviceTracker(dtticket, dtuser, dtservice, dtnotes); const lineArray = prepDeviceTracker(dtticket, dtuser, dtservice, dtnotes);
const bUrl = generateFile(lineArray, true, false); const bUrl = generateFile(lineArray, true, false);
displayPdf(bUrl); displayPdf(bUrl);
if (window.navigator.userAgent.includes('Firefox')) printPdf();
} }
/** /**
@ -283,6 +280,12 @@ function displayPdf(blobUrl) {
const pdfViewerContainer = document.getElementById('pdfViewerContainer'); const pdfViewerContainer = document.getElementById('pdfViewerContainer');
pdfViewer.src = blobUrl; pdfViewer.src = blobUrl;
pdfViewerContainer.style.display = 'block'; pdfViewerContainer.style.display = 'block';
// Check UserAgent if it contains FireFox we go ahead and send the print dialog
if (navigator.userAgent.includes('Firefox')) {
printPdf();
} else {
alert('Make sure to select "Actual Size" or 100% in the print dialog for correct sizing.');
}
} }
function printPdf() { function printPdf() {