PDF can't understand Javascript,HTML5 etc...You need somehow to generate image and inject it in PDF. (use another lib to export chart to image)
Aug 4, 2017
2
Level 6
Export Laravel Charts to PDF
Hi there,
I am creating database charts using the Laravel Charting Package and it works great. After that I want to export the generated chart using Laravel DOMPDF. The PDF is created but it remains blank... This is what I have in my controller:
class PDFController extends Controller { public function getPDF(){ $chart = Charts::database(User::all(),'bar', 'material') // Setup the chart settings ->groupBy('username'); // Setup what the values mean
$pdf=PDF::loadView('test', ['chart' => $chart]);
return $pdf->stream('test.pdf');
}
}
and the view:
<title>My Charts</title>
{!! Charts::assets() !!}
</head>
<body>
<center>
{!! $chart->render() !!}
</center>
</body>
Thanks!
Please or to participate in this conversation.