I am putting together a PDF and in this PDF I have to put a graph that is being done by Highcharts
. I created an HTML and JS code, and it is creating the right one, the problem is that I need to get the HTML code of this rendered graphic and when I make the request in the link of the page that mounts the graphic, it brings the HTML not rendered, that is , without running JS to mount the chart.
<?php
public function SendRequest($url){
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $url);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, 1);
$query = curl_exec($curl_handle);
curl_close($curl_handle);
return $query;
}
public function cria_grafico($id_pedido, $id_produto){
echo $this->load->view('sellins/GeraGraficoSellinB4', array('id_pedido'=>$id_pedido, 'id_produto'=>$id_produto), TRUE);
}
public function download($codigo_pedido = false){
$grafico = $this->SendRequest(base_url('Sellin_B4/cria_grafico/'.$produto['idPedido'].'/'.$produto['codigoProduto']));
$file = 'uploads/extract_sellin_goagro_'.time().'.pdf';
$mpdf = new mPDF();
$mpdf->SetHeader('Go Agro - Extract Sellin');
$mpdf->writeHTML($grafico);
$mpdf->SetFooter('{PAGENO}');
$mpdf->Output($file, 'F');
}
In the create_graphic method this is where it calls HTML with JS and mounts the chart. If I access the link miite.com.br/cria_grafico it shows the graphic rendered, but when I make a request to obtain the same result via code, it brings HTML without being rendered.