1

Can somebody help me with google chart images to load?
An example:
[url]https://chart.googleapis.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World[/url]
[img]https://chart.googleapis.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World[/img]

They do not work when embedded within html and the html is called to make the pdf. The pdf fails, and says the Image was impossible to get.

Whereas, if I just try and call the image using tcpdf manually with $pdf->Image('url...','other parameters'...) it works fine. So there seems to be something that is not quite working in html2pdf. Also a side note, even tried using the latest tcpdf with this version of html2pdf, and that had even more problems. Mainly that it was messing up bolded text, either not displaying it, or displaying it as italics.

Any help is appreciated. I love this program and this has been my only hiccup so far!

Thanks

2

After some more digging, I'm getting closer to the problem. The error draws my attention to line:1319 which has to do with the protected function _drawImage()

I am now thinking the original problem is being caused because "@getimagesize" is failing to actually get the true image size.
So really, the problem isn't really a html2pdf problem, but a php problem.

Now here's the trick, part of the parameters I'm sending to google include the image width and height! Just the parameters the @getimagesize is looking for! The part in the url is {&chs=$width."x".$height}

The only way I could get this working was to remove all height and width calculations from the html2pdf.class file and replace it with:
$scr = $src; //because my var is a dif spelling
$g_height = substr($scr,strrpos($scr,'&chs=')+5,strrpos($scr,'x',strrpos($scr,'&chs=')+5)-strrpos($scr,'&chs=')-5);
$g_width = substr($scr,strrpos($scr,'x',strrpos($scr,'&chs=')+5)+1,strpos($scr,'&',strrpos($scr,'x',strrpos($scr,'&chs=')+5)+1)-strrpos($scr,'x',strrpos($scr,'&chs=')+5)-1);
$imageWidth = $g_height/$this->pdf->getK(); //looks like a also mixed up height and width
$imageHeight = $g_width/$this->pdf->getK();
$w = .5*$imageWidth; // for some reason all the images came out 2x as big as they should be
$h = .5*$imageHeight;

I really wish I didn't have to break the html2pdf to get this to work. If there's any cleaner or simpler fixes, I'd be more than happy to try them.

Thanks

3

Hello unkynd

It seems that i experience de same problem , I have htmltopdf release V4.03 for php5 , I can't locate where did modify the htmltopdf class !!
I have no error displayed ( nothing !!) .
Can you give me your sample code to test it in my app ?

Thanks for your help !