i'm trying to convert a html document to a pdf using javascript but the quality is significally lower than it should be ( text is blurry, colors are not pure ,... ) even though it's displaying fine in my web browser.
here is the pdf generator function i'm using :
public convertToPDF()
{
let domElement = this.pdfTable.nativeElement as HTMLElement;
html2canvas(domElement).then(canvas => {
// Few necessary setting options
var imgWidth = 210;
var pageHeight = 750;
var imgHeight = canvas.height * imgWidth / canvas.width;
var heightLeft = imgHeight;
const contentDataURL = canvas.toDataURL('image/png')
let pdf = new jspdf('p', 'mm', 'a4'); // A4 size page of PDF
var position = 0;
pdf.addImage(contentDataURL, 'JPG', 0, position, imgWidth, imgHeight)
pdf.save('new-file.pdf'); // Generated PDF
});
}