title: Save google charts as pdf
body: <p>I am trying to save the piechart as a pdf file as in <a href="http://keepcoding.ehsanabbasi.com/php/convert-google-chart-to-png-and-pdf/" rel="nofollow">http://keepcoding.ehsanabbasi.com/php/convert-google-chart-to-png-and-pdf/</a>
  Having javascript inside php.chartsrc shows up the following value rather than the png image source</p>
  
  <p>"<code>function (){if(!this.b||!this.$||!this.Ua)throw m("Chart has not finished drawing.");var a=new Ql(this.V,this.Aa),b=Tl(this.ma)[Wb](ih),a=YO(b,a),a=new EO(b,a),c=new RO(b),a=this.sO(c,a),c=yY(this.ig,this.$,this.Ua);a.Lp(this.$,c);return b[cc][0].toDataURL(Ssa)} failed (filesystem path '/var/www/html/function (){if(!this.b||!this.$||!this.Ua)throw m("Chart has not finished drawing.");var a=new Ql(this.V,this.Aa),b=Tl(this.ma)[Wb](ih),a=YO(b,a),a=new EO(b,a),c=new RO(b),a=this.sO(c,a),c=yY(this.ig,this.$,this.Ua);a.Lp(this.$,c);return b[cc][0].toDataURL(Ssa)}')</code>"</p>
  
  <pre><code> $script ="
  
          google.setOnLoadCallback(drawChart);
          function drawChart() { //code for drawing chart}
          var chart = new google.visualization.PieChart(document.getElementById('piechart'));
  
          google.visualization.events.addListener(chart, 'ready', function ()      {
          var chartsrc = chart.getImageURI();
       });
  
        $doc-&gt;addScriptDeclaration($script);
        echo "&lt;div id='piechart'&gt;&lt;/div&gt;";
  </code></pre>