2

trying to export my CartJS to PDF file using JavaScript.

I've found a solution for jsPDF ,and its working but the generated PDF view is too small. This is my chart: enter image description here

and this is generated file: enter image description here

My code:

html2canvas($("#canvasChart"), {
            onrendered: function(canvas) {         
                var imgData = canvas.toDataURL({
                    format: 'jpeg',
                    quality: 0.9 // compression works now!
                });  

                var doc = new jsPDF("l", "mm", "a4");
                doc.addImage(imgData, 'PNG', 100, 100);
                doc.save('sample-file.pdf');
            }
        });

I will be very thankful for help and explanation what I am doing wrong. Thanks in advance,

python_beg2
  • 299
  • 4
  • 13

0 Answers0