html2pdf version 0.10 and 0.9 doesn't create pdf

49 Views Asked by At

html2pdf v0.8 works fine with

html2pdf(printelement, option)

But html2pdf v0.9 and 0.10 doesn't work. My code:

var print = document.getElementById('pdfHolder')

var opt = {
    margin: 15,
    filename: `${document.getElementById("consumerName").innerHTML}.pdf`,
    image: { type: 'jpeg', quality: 1 },
    html2canvas: {
        dpi: 192,
        scale: 4,
        letterRendering: true,
        useCORS: true,
    },
    pagebreak: { mode: ['avoid-all', 'css', 'legacy'] },
    jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }
};
var worker = html2pdf().set(opt).from(print).save();

If I print the worker it shows: (https://i.stack.imgur.com/PFmjX.png)

message: "CanvasRenderingContext2D.createPattern: Passed-in canvas has height 0"

0

There are 0 best solutions below