This commit is contained in:
Skylar Grant 2024-09-13 09:23:25 -04:00
parent ede4b8593d
commit 75874a6040
2 changed files with 3 additions and 4 deletions

View File

@ -18,10 +18,10 @@ app.post('/print-credentials', async (req, res) => {
return res.status(400).json({ message: 'Username and Student ID are required.' });
}
// Generate the information string
const infoString = Thermal.generateInfo.credentials(username, studentId);
const infoArray = Thermal.generateInfo.credentials(username, studentId);
// Generate the PDF, saved to disk
Thermal.generatePdf(infoString).catch(e => {
Thermal.generatePdf(infoArray).catch(e => {
console.error(e);
res.status(500).json({ message: 'Error writing PDF file', error: e.message });
});

View File

@ -22,7 +22,7 @@ module.exports = {
generateInfo: {
credentials(username, studentId) {
// Create the output text
const infoArray = [
return [
{ font: 'Courier-Bold', text: `Username: ${username}` },
{ font: 'public/Outfit-Regular.ttf', text: '' },
{ font: 'public/Outfit-Regular.ttf', text: 'Email:' },
@ -32,7 +32,6 @@ module.exports = {
{ font: 'public/Outfit-Regular.ttf', text: '' },
{ font: 'public/Outfit-Regular.ttf', text: 'Note: the MyKV Portal uses your username to sign in, not email.' },
]
return infoArray.join('\n');
},
maineCC() {
// Create the output text