?
This commit is contained in:
		
							parent
							
								
									8581027340
								
							
						
					
					
						commit
						20da340bf7
					
				| @ -21,9 +21,9 @@ app.post('/print-credentials', async (req, res) => { | ||||
| 		const infoString = Thermal.generateInfo.credentials(username, studentId); | ||||
| 
 | ||||
| 		// Generate the PDF, saved to disk
 | ||||
| 		Thermal.generatePdf(infoString).then(resolve => { | ||||
| 		Thermal.generatePdf(infoString).then(result => { | ||||
| 			// Print the document
 | ||||
| 			Thermal.print().then(resolve => { | ||||
| 			Thermal.print().then(result => { | ||||
| 				res.send('PDF sent to printer successfully.'); | ||||
| 			}).catch(e => { | ||||
| 				console.error('Failed to start printing process:', e); | ||||
| @ -79,9 +79,9 @@ app.post('/print-mcc', async (req, res) => { | ||||
| 		const infoString = Thermal.generateInfo.maineCC(); | ||||
| 
 | ||||
| 		// Generate the PDF, saved to disk
 | ||||
| 		Thermal.generatePdf(infoString).then(res => { | ||||
| 		Thermal.generatePdf(infoString).then(result => { | ||||
| 			// Print the document
 | ||||
| 			Thermal.print().then(res => { | ||||
| 			Thermal.print().then(result => { | ||||
| 				res.send('PDF sent to printer successfully.'); | ||||
| 			}).catch(e => { | ||||
| 				console.error('Failed to start printing process:', err); | ||||
| @ -89,11 +89,11 @@ app.post('/print-mcc', async (req, res) => { | ||||
| 			}); | ||||
| 		}).catch(e => { | ||||
| 			console.error(e); | ||||
| 			res.status(500).json({ message: 'Error writing PDF file', error: err.message }); | ||||
| 			res.status(500).json({ message: 'Error writing PDF file', error: e.message }); | ||||
| 		}); | ||||
| 	} catch (error) { | ||||
| 		console.error('Print Error:', error); | ||||
| 		res.status(500).json({ message: 'Print Error', error: error.message }); | ||||
| 	} catch (e) { | ||||
| 		console.error('Print Error:', e); | ||||
| 		res.status(500).json({ message: 'Print Error', error: e.message }); | ||||
| 	} | ||||
| }); | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user