Google Chart is not rendering in PDF created by wkhtmltopdf

Viewed 442

The google chart images were perfectly coming in PDF till few months back. But now images are not coming.

If I try the html, google chart is coming correctly. If I try to convert that HTML into PDF using wkhtmltopdf, chart not showing. I am using wkhtmltopdf from command line.

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>GRAPH</title>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
 
</head>
<body>
 
<table width="100%">
<tr>
<td align="center">
<b>GRAPH</b>
</td>
</tr>
<tr>
<td align="center">
<div class="text-center" id="chart_div70918" style="display: block; margin: 0 auto; width: 400px;height: 160px; "></div>
</td>
</tr>
</table> 
<script type="text/javascript"> 
            var scr = document.createElement("script");
            scr.setAttribute("src",'https://www.google.com/jsapi?autoload={"modules":[{"name":"visualization","version":"1","packages":["corechart", "bar"],"callback":"drawChart70918"}]}');
            document.head.appendChild(scr);  

            function drawChart70918() {
                  var data = google.visualization.arrayToDataTable([
                    ["Subject", "Class Highest", "Marks Obtained", { role: "style" } ]
                    ,["English", 13, 43, "#1909a0"],["Hindi -Oral", 48, 40, "#1909a0"],["Maths", 13, 38, "#1909a0"],["G.k.", 12, 39, "#1909a0"],["Drawing", 48, 44, "#1909a0"]  ]);

                  var view = new google.visualization.DataView(data); 
                    var options = {   
                        fontSize : 6,
                        fontName: 'Times New Roman',
                        hAxis :{showTextEvery:1,"slantedText":true, "slantedTextAngle": 45 },  
                        vAxis: {minValue: 0},
                        legend: { position: "right" },
                        colors: ['#a5e893', '#1909a0'],
                        bar: {groupWidth: "40%"},   
                        chartArea:{left:10,top:20,width:'75%',height:'60%'}
                    };
                        
                        var chart = new google.visualization.ColumnChart(document.getElementById("chart_div70918"));
                        chart.draw(view, options);
                }
              </script>
 
    </body>
</html>

0 Answers
Related