?
This commit is contained in:
parent
b0d163f07e
commit
12fd3ed9f3
@ -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' });
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user