?
This commit is contained in:
parent
ede4b8593d
commit
75874a6040
@ -18,10 +18,10 @@ app.post('/print-credentials', async (req, res) => {
|
|||||||
return res.status(400).json({ message: 'Username and Student ID are required.' });
|
return res.status(400).json({ message: 'Username and Student ID are required.' });
|
||||||
}
|
}
|
||||||
// Generate the information string
|
// Generate the information string
|
||||||
const infoString = Thermal.generateInfo.credentials(username, studentId);
|
const infoArray = Thermal.generateInfo.credentials(username, studentId);
|
||||||
|
|
||||||
// Generate the PDF, saved to disk
|
// Generate the PDF, saved to disk
|
||||||
Thermal.generatePdf(infoString).catch(e => {
|
Thermal.generatePdf(infoArray).catch(e => {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
res.status(500).json({ message: 'Error writing PDF file', error: e.message });
|
res.status(500).json({ message: 'Error writing PDF file', error: e.message });
|
||||||
});
|
});
|
||||||
|
@ -22,7 +22,7 @@ module.exports = {
|
|||||||
generateInfo: {
|
generateInfo: {
|
||||||
credentials(username, studentId) {
|
credentials(username, studentId) {
|
||||||
// Create the output text
|
// Create the output text
|
||||||
const infoArray = [
|
return [
|
||||||
{ font: 'Courier-Bold', text: `Username: ${username}` },
|
{ font: 'Courier-Bold', text: `Username: ${username}` },
|
||||||
{ font: 'public/Outfit-Regular.ttf', text: '' },
|
{ font: 'public/Outfit-Regular.ttf', text: '' },
|
||||||
{ font: 'public/Outfit-Regular.ttf', text: 'Email:' },
|
{ 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: '' },
|
||||||
{ font: 'public/Outfit-Regular.ttf', text: 'Note: the MyKV Portal uses your username to sign in, not email.' },
|
{ font: 'public/Outfit-Regular.ttf', text: 'Note: the MyKV Portal uses your username to sign in, not email.' },
|
||||||
]
|
]
|
||||||
return infoArray.join('\n');
|
|
||||||
},
|
},
|
||||||
maineCC() {
|
maineCC() {
|
||||||
// Create the output text
|
// Create the output text
|
||||||
|
Loading…
Reference in New Issue
Block a user