I want to make pdf invoice from a template (blade html) using dompdf in laravel 5.5.
The problem is when click on download button the page is loading and after ~3 min a get the pdf.
Why is taking so long?
the download link
<a href="" target="_blank" class="btn btn-danger"><i class="fa fa-file-pdf-o"></i> Download Invoice</a>
web route:
Route::get('/order/download-invoice/{OrderID}', 'Admin\AdminOrderController@downloadOrderInvoice')->name('admin.download-invoice');
a simple template (invoice.blade.php)
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other
head content must come *after* these tags -->
<title>Invoice</title>
<link rel="stylesheet" href="" media="screen">
</head>
<body>
<div> </div>
</body>
</html>
donwload invoice controller function:
use Barryvdh\DomPDF\Facade as PDF;
public function downloadOrderInvoice($OrderID){
$invoice = Invoice::where('OrderID', $OrderID)->first();
$pdf = PDF::loadView('invoice.invoice', compact('invoice'))->setPaper('a4', 'landscape');
return $pdf->download('invoice.pdf');
}
What i did wrong? Did i miss something?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2JkoCSN
via IFTTT
Aucun commentaire:
Enregistrer un commentaire