This commit is contained in:
Skylar Grant 2024-09-09 13:41:14 -04:00
parent b0d163f07e
commit 12fd3ed9f3
1 changed files with 2 additions and 10 deletions

View File

@ -27,7 +27,7 @@ module.exports = {
// Create a new PDF document
const doc = new PDFDocument({
size: [204, 1000],
size: [204, 400],
margin: 5
});
@ -69,15 +69,7 @@ module.exports = {
// Handle the process exit event
printer.on('close', (code) => {
if (code === 0) {
// Delete the file after printing to clean up
fs.unlink(pdfFilePath, (err) => {
if (err) {
console.error('Error deleting file:', err);
res.status(500).json({ message: 'Failed to clean up after printing', error: err.message });
return;
}
res.send('PDF sent to printer successfully.');
});
} else {
res.status(500).json({ message: 'Failed to print PDF' });
}