I want to download a PDF file from an associative array which looks like this:
$Array_data= Array(
[0] => Array
(
[Date] => 2017-01-02
[Name] => Asia consumer MC Alpha bmk - risk
[Level] => .333000
)
[1] => Array
(
[Date] => 2017-01-03
[Name] => Asia consumer MC Alpha bmk - risk
[Level] => .333000
))
I have tried many libraries named snappypdf, Fpdf, codedge/laravel but nothing seems to work.
I've tried this:
$pdf = new PDF();
$pdf->SetFont('Arial','',48);
$pdf->AddPage();
$pdf->Cell(40,10,"Hello World!",15);
$pdf->Output();
And this
$string = json_encode($Array_data);
$response = new Response($string);
$disposition = $response->headers->makeDisposition(
ResponseHeaderBag::DISPOSITION_ATTACHMENT,
'foo.pdf');
return $response->headers->set('Content-Disposition', $disposition);
After searching nothing seems to work. How can I get this done?