PDA

View Full Version : dompdf how to pass url name



coolumanga
02-01-2012, 12:31 PM
hear i have the code

$html ='www.yahoo.com';

$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");

how do i pass the www.yahoo.com page to to pdf

hear if i use like above it will give only the text

plzz help me to do that

wldrumstcs
02-01-2012, 02:12 PM
You have to get the contents of www.yahoo.com, not just pass in the name. Try this:


$html = file_get_contents("http://www.yahoo.com");
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");

KuriosJon
02-01-2012, 02:18 PM
Good luck with DOMPDF. It's actually pretty good for what it does, but the last time I used it a year or two ago it had trouble with anything even remotely advanced (like nested tables).

Using DOMPDF on the yahoo home page will probably give you some really weird results.