jsPDF icon indicating copy to clipboard operation
jsPDF copied to clipboard

I am trying to convert HTML with amcharts 3 graph into PDF.

Open allgrowsm opened this issue 5 years ago • 3 comments

I have multiple charts using amChart3 and try to conver them into PDF like following.

      const { jsPDF } = window.jspdf;       
      const doc = new jsPDF('l', 'pt', 'a4', false);  
      doc.html(document.body, {
        callback: function (doc) {  
        doc.save();
        },
        x: 10, 
        y: 
 });

But, I am getting multiple errors like these.

Error loading svg

This page contains the following errors:
error on line 1 at column 167: AttValue: ' expected
Below is a rendering of the page up to the first error.

jsPDF dose not support charts?

allgrowsm avatar Mar 24 '21 06:03 allgrowsm

here is jsfiddle https://jsfiddle.net/masaos/w5rv07bt/2/

allgrowsm avatar Mar 24 '21 06:03 allgrowsm

The heavy-lifting of the html method is done by html2canvas. I assume html2canvas simply does not support SVG.

Since the chart is mostly SVG, you might try the svg2pdf plugin.

HackbrettXXX avatar Mar 24 '21 16:03 HackbrettXXX

This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.

github-actions[bot] avatar Jun 23 '21 01:06 github-actions[bot]