This commit is contained in:
Skylar Grant 2024-09-09 13:16:52 -04:00
parent de42b487f5
commit 91b455ebf6

View File

@ -4,10 +4,18 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Print</title> <title>Test Print</title>
<style>
#pdfViewer {
width: 100%;
height: 600px; /* Adjust as needed */
border: none;
}
</style>
</head> </head>
<body> <body>
<h1>Thermal Printer Test</h1> <h1>Thermal Printer Test</h1>
<button id="testPrintBtn">Test Print</button> <button id="testPrintBtn">Test Print</button>
<iframe id="pdfViewer" style="display:none;"></iframe>
<script> <script>
document.getElementById('testPrintBtn').addEventListener('click', () => { document.getElementById('testPrintBtn').addEventListener('click', () => {
@ -15,7 +23,9 @@
.then(response => response.blob()) .then(response => response.blob())
.then(blob => { .then(blob => {
const url = URL.createObjectURL(blob); const url = URL.createObjectURL(blob);
window.open(url); const pdfViewer = document.getElementById('pdfViewer');
pdfViewer.src = url;
pdfViewer.style.display = 'block'; // Show the iframe
}) })
.catch(error => alert('Error: ' + error)); .catch(error => alert('Error: ' + error));
}); });