Search code examples
htmlangularjsamchartshtml2pdf

html2pdf generates corrupted parts in the downloaded file


I used html2pdf in my code to enable converting html files to pdf ones then downloading them. In my html file I have some statistic graphics coded using amChart. The problem is that I have got a perfect file but with corrupted parts. The parts that contains the amChart graphics.Here is the graph in the html page: and here is what I have got in the downloaded pdf fileenter image description here I used this code to enable the download (with angular I just installed the necessary dependecies using bower). Hello Someone

<div pdf-save-content="idOne" >
    Hello Someone
</div>

Can someone please help me fix this problem? I know that amchart provides a library to download the graphs with different forms (csv, png,pdf,..) it's not what need, I need to download the whole page. it's not either a width problem.


Solution

  • to solve this problem I used this amCharts demo. It was better to use pdfMake than html2pdf

    chart["export"].toPDF(layout, function(data) {
      this.download(data, "application/pdf", "amCharts.pdf");
    });