1

I have a online reporting tool that uses html2pdf to generate pdf and google chart api to generate graphs used in that pdf. Since today morning there is an error:

ERROR n°6
File : /public_html/beta/html2pdf/html2pdf.class.php
Line : 1319

Impossible to load the image https://chart.googleapis.com/chart?cht=pc&chs=150x90&chd=t:0|10,10,10,10,10,10&chco=FFFFFF,00ff3c|00ff3c|00ff3c|00ff3c|00ff3c|00ff3c&chl=|0|0|0|0|0|0

I have tried to open the link seperately to check for errors, however that works like a charm. I have tried using the chof=validate from google troubleshooting site, this shows that my chart script doesn't have a problem. I haven't changed anything on my site that could cause any disruptions.

I have run out of debugging solutions and am looking forward to your replies! Hope you can help me :)

Regards,

Babu

Babu
  • 35
  • 1
  • 4
  • Have you tried adding a "wait" before using the html2pdf to see if the issue is server response or loading time? Alternatively, you can possibly load the image separately and then add the image in to the document afterwards if the issue is that html2pdf is not recognizing the google url as an image? – jmac Apr 12 '13 at 00:21
  • Hi jmac, How would you recommend this to be done? – Babu Apr 12 '13 at 07:46
  • You can do it with PHP as described [here](http://stackoverflow.com/questions/5649808/download-image-file-from-given-google-chart-api-url-using-php) with a bit of modification (to change from download to display). – jmac Apr 12 '13 at 08:27
  • I've tried the following and still getting the same error: &chl= echo $valuestring;?>"]; echo ''; ?> – Babu Apr 12 '13 at 09:22

1 Answers1

0

The problem is in the image request... HTML2PDF has a bug loading remote PNG images (maybe any PNG I suspect), request the image as JPG or GIF

In your case the chart API support GIF's

https://chart.googleapis.com/chart?cht=pc&chs=150x90&chd=t:0|10,10,10,10,10,10&chco=FFFFFF,00ff3c|00ff3c|00ff3c|00ff3c|00ff3c|00ff3c&chl=|0|0|0|0|0|0&chof=gif

Regards

Dragnovich
  • 91
  • 1
  • 8