因此,the library中对此进行了很好的记录,但我无法使其正常工作。请考虑以下内容:
$pdf = PDF::loadView('modules.efapreports.pdf.invoice', [
'invoiceData' => $this->collection,
'organization' => $organization,
'invoiceNumber' => $this->formFields['invoice_number'],
'invoiceDate' => $this->formFields['invoice_date'],
'dueDate' => $this->formFields['due_date'],
'payementTerms' => $this->formFields['payment_terms'],
'gst' => 1.05,
]);
$pdf->save(storage_path(
'efapinvoices/' . $this->getPath() .'/'. $this->getFileName() . $this->getExtension()
));
$pdf->download(storage_path(
'efapinvoices/' . $this->getPath() .'/'. $this->getFileName() . $this->getExtension()
));
这可以完美地保存它,但不会下载。我必须加载pdf文件吗?
答案 0 :(得分:1)
return PDF::loadView('modules.efapreports.pdf.invoice', [
'invoiceData' => $this->collection,
'organization' => $organization,
'invoiceNumber' => $this->formFields['invoice_number'],
'invoiceDate' => $this->formFields['invoice_date'],
'dueDate' => $this->formFields['due_date'],
'payementTerms' => $this->formFields['payment_terms'],
'gst' => 1.05,
])->download();
答案 1 :(得分:0)
您可以使用dompdf软件包来解决与pdf相关的问题。 https://packagist.org/packages/dompdf/dompdf