I'm not 100% sure of my error here. I am getting this encoding output when I am trying to generate a PDF:
%PDF-1.4 %���� 3 0 obj <> /Contents 4 0 R>> endobj 4 0 obj <> stream x�S(T0�300@!�ҹ�iab�gai�
ji�g`
I am using Yii2 and the highcharts package https://github.com/2amigos/yii2-highcharts-widget along with the mPDF package https://github.com/kartik-v/yii2-mpdf.
My hope was to be able to generate a browser version of this graph and also a PDF version. The browser version works fine, but the PDF attempt doesn't. My code in the action is:
if($pdf == true){ // render as pdf
$content = $this->renderPartial('_overallPDF', [
'model' => $data,
]);
$doc = new Pdf([
// set to use core fonts only
'mode' => Pdf::MODE_UTF8,
// A4 paper format
'format' => Pdf::FORMAT_A4,
// portrait orientation
'orientation' => Pdf::ORIENT_LANDSCAPE,
// stream to browser inline
'destination' => Pdf::DEST_BROWSER,
// your html content input
'content' => $content,
]);
return $doc->render();
}
I am not sure of the problem here, could it be due to highcharts being a js library and the presentation done in browser?
Either way if anyone could help me find a solution to generate the graph as a PDF that would be great!