dimanche 29 octobre 2017

TCPDF save file then redirect

I'm using laravel 5.4 and elibyy/tcpdf-laravel to generated view to PDF. Now I'm trying to save the file then redirect to another page.

I've tried like this, but it became just save and download the file. Not redirect me to the page I wanted.

$view = View::make('view', compact('anything'));
$html = $view->render();

$pdf = new TCPDF();
$pdf::setFooterCallback(function($pdfs) {
    $pdfs->SetY(-15);
    $pdfs->SetFont('helvetica', 'I', 8);
    $pdfs->Cell(0, 10, 'Page '.$pdfs->getAliasNumPage().' of '.$pdfs->getAliasNbPages(), 0, false, 'R', 0, '', 0, false, 'T', 'M');
});
$pdf::SetTitle('Title');
$pdf::AddPage();
$pdf::writeHTML($html, true, false, true, false, '');
$pdf::Output(public_path('path/to/location/file.pdf'), 'FD');

return redirect()->route('somewhere')->with('success', 'Success');



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2zSroX3
via IFTTT

Aucun commentaire:

Enregistrer un commentaire