I am using jsPDF in a Vue 2 project to generate a PDF report. The issue I’m facing is that my calculated numbers are not appearing in the generated PDF, even though they print correctly in the console.The data type of totalNumberOfLicense.USED and FREE are long(as per server side).
const totalBind = Number(this.totalNumberOfLicense.USED);
const totalAvailable = Number(this.totalNumberOfLicense.FREE);
const newLicenseIssued = totalAvailable + totalBind;
console.log("totalBind : ", totalBind);
console.log("Free: ", totalAvailable);
console.log("New License Issued: ", newLicenseIssued);
const licenseSummary = `Base License (New License Issued): ${newLicenseIssued},Total Bind: ${totalBind}, Total Available: ${totalAvailable}`;
doc.text(licenseSummary, leftMargin, imgY + imgHeight + 44);
Console output
totalBind : 536
Free: 13525
New License Issued: 14061
However, in the generated PDF, the text appears as:
Base License (New License Issued): , Total Bind: , Total Available:
How to fix this issue ?
The following change correctly print the required data in pdf
var licenseSummary = "Base License (New License Issued): " + newLicenseIssued + ",Total Bind: " + totalBind +",Total Available: " + totalAvailable;