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 ?
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 ?
Share Improve this question edited Mar 20 at 7:35 DarkBee 15.5k8 gold badges72 silver badges117 bronze badges asked Mar 20 at 7:28 Shanta Kumar dasShanta Kumar das 416 bronze badges 2 |1 Answer
Reset to default 0The following change correctly print the required data in pdf
var licenseSummary = "Base License (New License Issued): " + newLicenseIssued + ",Total Bind: " + totalBind +",Total Available: " + totalAvailable;
licenseSummary
before that last line, it gives you what? – C3roe Commented Mar 20 at 7:45