this my js code that i use, i can download the file normally, everything is organized correctly, but the language appears incorrectly, as it appears detached and incorrectly rendered.
let downloadPDF = document.getElementById("download");
downloadPDF.addEventListener("click", (e) => {
e.preventDefault();
let certif = document.getElementById('certificate-content');
html2canvas(certif, {
scale: 2,
useCORS: true,
logging: true,
foreignObjectRendering: true,
letterRendering: 1,
allowTaint: true,
async: false,
}).then(canvas => {
let imgData = canvas.toDataURL("image/jpeg", 0.98);
let pdf = new jsPDF('landscape', 'px', 'a4');
let pageWidth = pdf.internal.pageSize.width;
let pageHeight = pdf.internal.pageSize.height;
let imgWidth = pageWidth;
let imgHeight = (canvas.height * imgWidth) / canvas.width;
pdf.addImage(imgData, 'JPEG', 0, 0, imgWidth, imgHeight);
// Download the PDF
pdf.save('Udemy-certificate.pdf');
}).catch(err => {
console.error("Error generating PDF:", err);
});
});