better pdf naming

This commit is contained in:
sairaj mote 2022-12-04 23:58:40 +05:30
parent 31d0aef1cf
commit fb13c81991

View File

@ -351,7 +351,7 @@
canvas.getContext('2d').drawImage(img, 0, 0); canvas.getContext('2d').drawImage(img, 0, 0);
const imgData = canvas.toDataURL('image/png'); const imgData = canvas.toDataURL('image/png');
certPdf.addImage(imgData, 'PNG', 620, 670, 160, 160); certPdf.addImage(imgData, 'PNG', 620, 670, 160, 160);
certPdf.save('certificate.pdf'); certPdf.save(`RanchiMall ${certType.toLowerCase()} for ${name}.pdf`);
}; };
} }
} }
@ -372,9 +372,9 @@
if (floData.includes('|')) { if (floData.includes('|')) {
[certType, floId, name, certPara] = floData.split('|') [certType, floId, name, certPara] = floData.split('|')
} else { } else {
floId = floData.match(/\b\w{30,36}\b/)?.[0] floId = floData.match(/\b\w{30,36}\b/)?.[0].trim()
name = getBetween(floData, 'certifies that', 'FLO ID') name = getBetween(floData, 'certifies that', 'FLO ID').trim()
certType = getFirstThreeWords(floData) certType = getFirstThreeWords(floData).trim()
isNewer = false isNewer = false
} }
if (!floId) continue; if (!floId) continue;