Can't Create Pie Charts on PDF

17 views
Skip to first unread message

Amy Fletcher

unread,
Sep 12, 2016, 1:33:49 PM9/12/16
to Google Visualization API
I have a report that displays several pie charts.  When I load this page in a browser, everything works fine.  My company has a function set up that allows me to create a PDF of a webpage.  When I load this URL into that function, the pie charts don't render.  Basically I can't get any JavaScript to run after this line:

google.charts.load('current', {'packages':['corechart']});

This used to work fine, but stopped at some point.  I'm tasked with trying to figure out what went wrong. 

This is the code where I pass the URL of the page I want to generate the PDF.  I'm not sure what library we are using for that.

$url = "http://the.chkmengine.com/create.php?ispdf=true&url=$_REQUEST[url]";

// get the file
$response
= file_get_contents($url);
$return
= json_decode($response, true);
$url
= $return[0];
$file
= "$_REQUEST[filename]_" . date("Ymd", time()) . ".pdf";
wget
($url, "/tmp/$file");

// now spit it back out
header
("Content-Disposition: attachment; filename=$file");
header
("Content-Type: application/pdf");
header
("Content-Description: File Transfer");
header
("Content-Length: " . filesize("/tmp/$file"));
readfile
("/tmp/$file");
die();

Any help would be appreciated.  Thanks!
Reply all
Reply to author
Forward
0 new messages