var opt = {
margin: 0.3,
filename: 'myfile.pdf',
image: { type: 'jpeg', quality: 3 },
html2canvas: { scale: 3,allowTaint: true, scale: 2, logging: true, dpi: 300, letterRendering: true, scrollY: -window.scrollY, scrollX: -window.scrollX },
pagebreak: { mode: ['avoid-all', 'css', 'legacy'] },
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait',precision: '1' }
};
// choose the element and pass it to html2pdf() function and call the save() on it to save as pdf.
html2pdf().set(opt).from(element).save();