custom-scripts/mccs-it/thermal/public/index.html

35 lines
1.1 KiB
HTML
Raw Normal View History

2024-09-06 23:26:30 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Print</title>
2024-09-09 17:16:52 +00:00
<style>
#pdfViewer {
width: 100%;
height: 600px; /* Adjust as needed */
border: none;
}
</style>
2024-09-06 23:26:30 +00:00
</head>
<body>
<h1>Thermal Printer Test</h1>
<button id="testPrintBtn">Test Print</button>
2024-09-09 17:16:52 +00:00
<iframe id="pdfViewer" style="display:none;"></iframe>
2024-09-06 23:26:30 +00:00
<script>
document.getElementById('testPrintBtn').addEventListener('click', () => {
fetch('/test-print', { method: 'POST' })
2024-09-09 17:11:53 +00:00
.then(response => response.blob())
.then(blob => {
const url = URL.createObjectURL(blob);
2024-09-09 17:16:52 +00:00
const pdfViewer = document.getElementById('pdfViewer');
pdfViewer.src = url;
pdfViewer.style.display = 'block'; // Show the iframe
2024-09-09 17:11:53 +00:00
})
2024-09-06 23:26:30 +00:00
.catch(error => alert('Error: ' + error));
});
</script>
</body>
</html>